Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Control

Status
Not open for further replies.

bdavis96

Programmer
Feb 11, 2002
97
US
I have a textbox that takes in a Percent. I am using TextBox_Validate(Cancel As Boolean) to make sure that if value entered is not numeric or if the percent is less then 0 or greater then 100, Cancel flag is set and focus stays with textbox. If a correct value is entered, I want focus to go to a combobox, but it looks like Combobox.Setfocus doesn't work. Code Example:

Private Sub Textbox_Validate(Cancel As Boolean)
If IsNumeric(Textbox) And Textbox >= 0 And Textbox <= 100 Then
Combobox.SetFocus - Doesn't seem to work
Else
Cancel = True - Focus Stays with Textbox
End If
End Sub

Any Ideas?

 
More clarification:

SetFocus is overrided by tab key or another object click event. I want SetFocus to override anything that the user does, guaranteeing that the combobox gets focus.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top