powershell中的组合框......如何根据下拉选择进行处理
Combo Box in powershell... how to process based on drop down selection
下面是代码片段,从下拉列表中选择计算机名称并输入它应该会在文本文件中产生如下所示的结果。组合框选择如何显示错误。
`$buttonEnter_Click= {
if ($combobox1.SelectedItem.ToString == "Computer name")
{
$path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;
}
}`I have a combo box based on drop down selection it should give output in text file. Computer name, computer description should come in text file once enter button is clicked
尝试这样的事情
$handler_button1_Click=
{
if ($combobox1.Text -eq "Computer name")
{
$form1.Text = $combobox1.Text;
$path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;
}
}
$buttonEnter.add_Click($handler_button1_Click)
$form1.Controls.Add($buttonEnter)
下面是代码片段,从下拉列表中选择计算机名称并输入它应该会在文本文件中产生如下所示的结果。组合框选择如何显示错误。
`$buttonEnter_Click= {
if ($combobox1.SelectedItem.ToString == "Computer name")
{
$path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;
}
}`I have a combo box based on drop down selection it should give output in text file. Computer name, computer description should come in text file once enter button is clicked
尝试这样的事情
$handler_button1_Click=
{
if ($combobox1.Text -eq "Computer name")
{
$form1.Text = $combobox1.Text;
$path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;
}
}
$buttonEnter.add_Click($handler_button1_Click)
$form1.Controls.Add($buttonEnter)