Dear All,
I cannot figure out how to enable a button when the $loginnametextbox is not empty. It stay disable.
Here i my code :
$loginametextbox.Text = $null
$formEnableUsersForm_Load={
#TODO: Initialize Form Controls here
$buttonOK.Enabled = $false
}
$buttonOK_Click={
#TODO: Place custom script here
$buttonOK.Enabled = $false
$loginametextbox.Text= {
$CheckInput
}
If ($CheckInput.text.trim() )
{
$buttonOK.Enabled = $true
}
}
enable button if $texbox not empty
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.
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.
Re: enable button if $texbox not empty
Use the validation event to set that when the textbox is update.
You can also use the TextChanged event to do this.
- $textbox1_Validated={
- if($textbox1.Text){
- $button1.Enabled = $true
- }else{
- $button1.Enabled = $false
- }
- }
Re: enable button if $texbox not empty
On to J's point, textchanged event is great if you have a predetermined number of characters and you can eliminate the button if you choose.