Having trouble changing the focus... 
Author Message
 Having trouble changing the focus...

I am rather new to VB and am having a heck of a time trying to figure out
how to move the focus to a new frame after I enter text in a text box.

After I enter text and while using a keypress procedure to check for
keyascii = 13 and a small routine to validate the entered text, I would
like the focus to switch to the next tabindex item or frame.

I am sure this is rather easy to do, but being new to VB the gotfocus and
setfocus aren't making sense to me.

Any help would be appreciated.

Thanks,

Kevin Gwash



Fri, 27 Oct 2000 03:00:00 GMT  
 Having trouble changing the focus...

Even though SetFocus is not what you want, I can't see how it doesn't make
sense:         Text1.SetFocus  --  Set the focus to Text1.
In the KeyPress event, when you get the KeyAscii of 13, put the line:
        SendKeys "{Tab}"
which will simulate the user pressing the <Tab> key, and advance the focus to
the next control in the tabindex.

Lee Weiner
weiner AT fuse DOT net


Quote:

>I am rather new to VB and am having a heck of a time trying to figure out
>how to move the focus to a new frame after I enter text in a text box.

>After I enter text and while using a keypress procedure to check for
>keyascii = 13 and a small routine to validate the entered text, I would
>like the focus to switch to the next tabindex item or frame.

>I am sure this is rather easy to do, but being new to VB the gotfocus and
>setfocus aren't making sense to me.

>Any help would be appreciated.

>Thanks,

>Kevin Gwash



Fri, 27 Oct 2000 03:00:00 GMT  
 Having trouble changing the focus...

Sub Text1_KeyPress (KeyAscii%)
        If KeyAscii = 13 then
                'validate the input
                ....
                KeyAscii = 0
                Text2.SetFocus
        Endif
End Sub



Quote:
> I am rather new to VB and am having a heck of a time trying to figure out
> how to move the focus to a new frame after I enter text in a text box.

> After I enter text and while using a keypress procedure to check for
> keyascii = 13 and a small routine to validate the entered text, I would
> like the focus to switch to the next tabindex item or frame.

> I am sure this is rather easy to do, but being new to VB the gotfocus and
> setfocus aren't making sense to me.

> Any help would be appreciated.

> Thanks,

> Kevin Gwash



Sat, 28 Oct 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB4 Question: Having trouble changing .ScrollBars property

2. Newbie having trouble with VBA Code in Access

3. Having Trouble populating an array from table values

4. getting reference path errors, having trouble fixing.

5. Having trouble programatically switching between fax and pdf report output

6. Having Trouble w/Data Validation Code (Acc97)

7. Having trouble with the TransferDatabase method

8. Still having trouble....

9. Having trouble sending multiple emails using outlook object

10. Having trouble getting the Alias (Account) field data from a global address

11. Having trouble defining global variables

12. Having trouble with template not printing

 

 
Powered by phpBB® Forum Software