I have Windows 7 with Visual Studio 2017 (Visual Basic).
I have a group box with two radio buttons and two text boxes. When radiobutton1
is checked the two text boxes are not available (Textbox.Enabled = false
).
When the user hits radiobutton2
the two text boxes are set to enabled = true
and the first text box gets the focus with textbox1.focus()
.
when the user doesn't enter any value and hits the radiobutton1 the two textboxes are set to enabled = false again.
When you do that, the disabled textbox1
looks different (inset) to textbox2
because it had the focus before it was disabled.
When radiobutton2
is checked and you fill in, for example, numvalues
to the text boxes and you use the enter button to validate both text boxes, there is no focus on the text boxes anymore. When you now hit radiobutton1
both disabled text boxes are looking the same.
What event can I use to take away the focus of the text box (which has the focus) before I hit the radiobutton1
?
Control.Focus()
method before disabling your textbox. If that doesn't work also try callingRefresh()
on your textbox to force it to redraw itself before disabling. – Visual Vincent