|
-
Sep 22nd, 2005, 07:22 AM
#1
Thread Starter
Frenzied Member
getting the last textbox that was focussed on and placing the focus on it
Hello
Is it possible to get the last textbox that was focussed on set the focus back on it.
what i mean is say i had footext1.text and then moved to footext2.
and then due to an error condition, i want to go back to footext1,
is it possible to get the last "focussed textbox" and then select that textbox again?
Last edited by vb_student; Sep 22nd, 2005 at 05:07 PM.
-
Sep 22nd, 2005, 07:33 AM
#2
Re: getting the last textbox that was focussed on and placing the focus on it
do your errorcheck in the Validate event of the checkbox...
Setting cancel to true will stop it from going to the next checkbox
like this:
VB Code:
Private Sub footext1_Validate(Cancel As Boolean)
If CheckForErrorIsError Then
Cancel = True
footext1.SelStart = 0
footext1.SelLength = Len(footext1)
End If
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 08:03 AM
#3
Thread Starter
Frenzied Member
Re: getting the last textbox that was focussed on and placing the focus on it
thanks for the reply
is the validate method used when the textbox is about to go out of focus?
i guess the footext1.length repastes the text previously in the textbox, correct?
i guess the checkforerror is a flag, and i should probably name itas footextcheckforerror and initialise it to True in the form_load method, correct?
-
Sep 22nd, 2005, 08:15 AM
#4
Re: getting the last textbox that was focussed on and placing the focus on it
no 
ok..
the the selstart & sellength are to make it Highlight the text in the textbox so when the user types it will replace whats there...
the checkforerror was just made up.. you need to put your code in to check for the error. (not sure what you are checking for)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 08:47 AM
#5
Thread Starter
Frenzied Member
Re: getting the last textbox that was focussed on and placing the focus on it
thanks for the reply [A51g]Static
is the answer no, for both my questions
1. is the validate method used when the textbox is about to go out of focus?
2. i guess the footext1.length repastes the text previously in the textbox, correct?
can you tell me when the validate method is fired?
is .selstart = 0 right before the first character
and is .selstart = 3 possible?
i guess if i have a textbox footext and then do
do
followed by
the .selstart value resets itself, correct?
-
Sep 22nd, 2005, 08:53 AM
#6
Re: getting the last textbox that was focussed on and placing the focus on it
1)yes, the validate fires as soon as you try to leave the textbox
2) the sellength is just setting how many characters to Select (Highlight)
you can set selstart anywhere in the textbox
selstart just places the cursor in that position
and yes, if you set selstart = 2 then change the text in the textbox, selstart goes back to 0
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 05:07 PM
#7
Thread Starter
Frenzied Member
Re: getting the last textbox that was focussed on and placing the focus on it
thanks for clearing my misunderstandings static
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
|