marcus_d
asked on
Tab Control - disable button when switching tabs.
Hi,
I have created a windows form with a tab control. Each tab control has a number of textboxes which are filled with data using databind. I have an "Apply" button which is disabled until any of the text is changed in the textboxes (using the .TextChanged handler). The problem is that when I click another tab the TextChanged handler is executed and the "Apply" button is enabled even though no text has been changed (see code example below).
Private Sub TextBox_Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbCompanyName.TextChanged
Me.btnApply.Enabled = True
End Sub
Anybody any ideas how to keep the apply button disabled if nothing was changed on the first tab?
Thanks
Marcus
I have created a windows form with a tab control. Each tab control has a number of textboxes which are filled with data using databind. I have an "Apply" button which is disabled until any of the text is changed in the textboxes (using the .TextChanged handler). The problem is that when I click another tab the TextChanged handler is executed and the "Apply" button is enabled even though no text has been changed (see code example below).
Private Sub TextBox_Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbCompanyName.TextChanged
Me.btnApply.Enabled = True
End Sub
Anybody any ideas how to keep the apply button disabled if nothing was changed on the first tab?
Thanks
Marcus
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Private Sub CompanyName_LostFocus(ByVa
If Me.tbCompanyName.Text <> strCompanyName Then
Me.btnApply.Enabled = True
End If
End Sub