K
Ken
I have a custom TabPage class the I add to a standard TabControl. I have a
NumericUpDown control on the TabPage whose Validating event is tied to a
method in the TabPage class. If the user types in a value, does not use the
up/down arrows to change the value, I validate the Text property in the
Validating event. If it is not valid I display a MessageBox then set the
cancel property of the CancelEventArgs to true, then call the NumericUpDown
control Focus method, then select the text of the NumericUpDown control.
This all works great if the user uses the Tab key to move to the next
control, or clicks another control on the current TabPage.
The problem arises when the user after typing in what is an invalid value
into the NumericUpDown control then clicks another Tab in the TabControl.
Here is what happens.
1. Enter invalid data on the current TabPage
2. Click another TabPage on the TabControl
3. The MessageBox is displayed twice with the originating TabPage visible.
4. The TabControl switches to the TabPage that was clicked
5. The MessageBox is displayed again. (Third time)
6. Anything after this causes the MessageBox to display and I can not leave
the TabPage that was clicked.
Can any one provide any ideas as to what is happening?
Thank You
Ken
NumericUpDown control on the TabPage whose Validating event is tied to a
method in the TabPage class. If the user types in a value, does not use the
up/down arrows to change the value, I validate the Text property in the
Validating event. If it is not valid I display a MessageBox then set the
cancel property of the CancelEventArgs to true, then call the NumericUpDown
control Focus method, then select the text of the NumericUpDown control.
This all works great if the user uses the Tab key to move to the next
control, or clicks another control on the current TabPage.
The problem arises when the user after typing in what is an invalid value
into the NumericUpDown control then clicks another Tab in the TabControl.
Here is what happens.
1. Enter invalid data on the current TabPage
2. Click another TabPage on the TabControl
3. The MessageBox is displayed twice with the originating TabPage visible.
4. The TabControl switches to the TabPage that was clicked
5. The MessageBox is displayed again. (Third time)
6. Anything after this causes the MessageBox to display and I can not leave
the TabPage that was clicked.
Can any one provide any ideas as to what is happening?
Thank You
Ken