Cakkie
March 27th, 2001, 04:06 AM
There's something weird going on, again.
I have some code in the validate event of a listbox. Depending on the choise several textboxes will change from disabled to enabled.
The textbox is the next in the tabindex, but the focus goes to the first enabled element in the tabindex (that is, before the textbox was enabled).
When I then use the SetFocus to force the focus to the enabled box, the focus still ends up at the wrong control:
this examples uses 3 textboxes, text2 is disabled, text3 is enabled
the tabindex for text1 = 1, text2 = 2, text3 = 3.
it should go from 1 to 2 to 3, but it doesn't
private Sub Text1_Validate(Cancel as Boolean)
If text1.text <> "" then
text2.enabled = true
else
text2.enabled = false
end if
End Sub
When using this code, it goes from text1 to text3, even when there's text in text1.
private Sub Text1_Validate(Cancel as Boolean)
If text1.text <> "" then
text2.enabled = true
text2.setfocus
else
text2.enabled = false
end if
End Sub
When using this code, it still goes from text1 to text3, although I specifically told him to go to text2
Any comments/suggestions?
Tom Cannaerts
slisse@planetinternet.be
The best way to escape a problem, is to solve it.
I have some code in the validate event of a listbox. Depending on the choise several textboxes will change from disabled to enabled.
The textbox is the next in the tabindex, but the focus goes to the first enabled element in the tabindex (that is, before the textbox was enabled).
When I then use the SetFocus to force the focus to the enabled box, the focus still ends up at the wrong control:
this examples uses 3 textboxes, text2 is disabled, text3 is enabled
the tabindex for text1 = 1, text2 = 2, text3 = 3.
it should go from 1 to 2 to 3, but it doesn't
private Sub Text1_Validate(Cancel as Boolean)
If text1.text <> "" then
text2.enabled = true
else
text2.enabled = false
end if
End Sub
When using this code, it goes from text1 to text3, even when there's text in text1.
private Sub Text1_Validate(Cancel as Boolean)
If text1.text <> "" then
text2.enabled = true
text2.setfocus
else
text2.enabled = false
end if
End Sub
When using this code, it still goes from text1 to text3, although I specifically told him to go to text2
Any comments/suggestions?
Tom Cannaerts
slisse@planetinternet.be
The best way to escape a problem, is to solve it.