Below is the code snippet, wen computer name is selected from the drop down and entered it should produce result in text file as shown below. How ever combo box selection is showing error.
`$buttonEnter_Click= {
if ($combobox1.SelectedItem.ToString == "Computer name")
{
$path = "$([Environment]::GetFolderPath("Desktop"))\information.txt";
gcim Win32_OperatingSystem | fL * | fl > $path; notepad $path;
}
try somethng like this
$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)