|
-
Apr 29th, 2002, 02:22 AM
#1
Thread Starter
Hyperactive Member
Setfocus troubles
MY setfocus function had been acting wierd and i was wondering if anyone else has encountered this problem. In my program,when a user enters incorrect data, it deletes the data in that textbox and then i do this
It deletes the current text fine but then set's the focus on the textbox below the one i put in the code. It also put the mouse on highlight so hen i move the mouse, it highlights whatever's in the lower textbox. It's not a huge problem but is annoying, could anyone help?
-Show me on the doll where the music touched you.
-
Apr 29th, 2002, 02:29 AM
#2
Hyperactive Member
What i do when a user enters incorrect info is just highlight the text for the user. But i had never experienced any problems such as the ones you are mentioning. This is how i do it.
In Module
VB Code:
Public Function Highlight(oTxt As Object)
oTxt.SetFocus
oTxt.SelStart = 0
oTxt.SelLength = Len(oTxt.Text)
End Function
In Form
VB Code:
'This is how you would call it
Private Sub cmdBla_Click()
Call Highlight(txtWhatEver)
End Sub
Hope this helps
-
Apr 29th, 2002, 02:37 AM
#3
Thread Starter
Hyperactive Member
That is quite a good idea , Thanks. I think that would look better than my old method. I just noticed that that involves setfocus and since mine is on the fritz, it still won't fix it.
-Show me on the doll where the music touched you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|