Reputation: 31
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
?
Upvotes: 0
Views: 864
Reputation: 31
the problem is solved.
because i had no other control to give the focus to i created a label with the width of 0 so one can't see the IBeam cursor.
For radiobutton1 i created a mouseenter and a mouseleave event. when the mouse is over radiobutton1 the "hidden" label gets the focus. when the mouse leaves radiobutton1 the textbox1 gets the focus again.
the refresh() method didn't help.
Thx for your comment Visual Vincent!
p.s.: i don't know why but only setting the focus to the label without using the mouse events didn't solve the problem!
Upvotes: 1