i made a userform with 2 textboxes (textbox1 and textbox2), and i added a button to the userform.
i also made a classmodule: checkinput
this module contains a function ispresent
The code reads:
Function ispresent(ByVal textbox As msforms.textbox) As Boolean
If textbox.Text = "" Or Not IsNumeric(textbox) Then
textbox.SetFocus ' here is my problem
ispresent = False
Else
ispresent = True
End If
End Function
the code in the userformmodule calls this function.
if the function ispresent is called and the passed textbox on the userforms contains nothing or a number, i want the focus be set on that particular textbox.
What happens is that the focus is being set but.. only for a fraction of a second.
what am i doing wrong?
Can anyone give me a hint.
Thx
i also made a classmodule: checkinput
this module contains a function ispresent
The code reads:
Function ispresent(ByVal textbox As msforms.textbox) As Boolean
If textbox.Text = "" Or Not IsNumeric(textbox) Then
textbox.SetFocus ' here is my problem
ispresent = False
Else
ispresent = True
End If
End Function
the code in the userformmodule calls this function.
if the function ispresent is called and the passed textbox on the userforms contains nothing or a number, i want the focus be set on that particular textbox.
What happens is that the focus is being set but.. only for a fraction of a second.
what am i doing wrong?
Can anyone give me a hint.
Thx