problem with radio buttons and comboboxes

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
mhenders
Posts: 5
Last visit: Thu Dec 01, 2022 5:29 am

problem with radio buttons and comboboxes

Post by mhenders »

I am trying to use three radio buttons on a form. My problem resides with the use of the "waitcursor". It takes a little time for my AD to be queried and the names placed in a combobox and whil waiting, I want to change the cursor to the waitcursor. If I select the button for 'xxxxxx', the cursor changes, the comboxbox is populated, and the cursor changes back to normal. If I then select the button for yyyyyy or zzzzzz, the cursor never changes even though the combobox is populated with the correct names. Can someone please bless my ignorance and tell me what I am doing wrong or why this behavior is happening.

Thanks!!!!!


$radiobuttonxxxxxx_CheckedChanged={
#TODO: Place custom script here
$MainFormDRT.UseWaitCursor = $true
$comboboxUserName.Items.Clear()
$adusers = Get-ADUser -SearchBase 'OU=xxxxxx,DC=eatmopossum,DC=org' -Filter '*' | Select -Exp Name
Update-ComboBox -ComboBox $comboboxUserName -Items $adusers
$comboboxUserName.SelectedIndex = 0
$MainFormDRT.UseWaitCursor = $false
}

$radiobuttonyyyyyy_CheckedChanged={
#TODO: Place custom script here
$MainFormDRT.UseWaitCursor = $true
$comboboxUserName.Items.Clear()
$adusers = Get-ADUser -SearchBase 'OU=yyyyyy,DC=eatmopossum,DC=org' -Filter '*' | Select -Exp Name
Update-ComboBox -ComboBox $comboboxUserName -Items $adusers
$comboboxUserName.SelectedIndex = 0
$MainFormDRT.UseWaitCursor = $false
}

$radiobuttonzzzzzz_CheckedChanged={
#TODO: Place custom script here
$MainFormDRT.UseWaitCursor = $true
$comboboxUserName.Items.Clear()
$adusers = Get-ADUser -SearchBase 'OU=zzzzzz,DC=eatmopossum,DC=org' -Filter '*' | Select -Exp Name
Update-ComboBox -ComboBox $comboboxUserName -Items $adusers
$comboboxUserName.SelectedIndex = 0
$MainFormDRT.UseWaitCursor = $false
}
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: problem with radio buttons and comboboxes

Post by jvierra »

Like this:

Code: Select all

$radiobutton1_CheckedChanged={
	$form1.Cursor = 'WaitCursor'
    # action code
	$form1.Cursor = 'Default'
}
User avatar
mhenders
Posts: 5
Last visit: Thu Dec 01, 2022 5:29 am

Re: problem with radio buttons and comboboxes

Post by mhenders »

thanks for the assist, it is working like I wanted it to.

Many, many THANKS!!!
This topic is 6 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked