SendKeys "{tab}" doesn't work 
Author Message
 SendKeys "{tab}" doesn't work

Hi ...

I'm suing VB6.

My application main form has an array of 60 text controls on it, namely
text8().

Common to the controls is the following sub.

When I type '>' (without the quotes), the textbox contents do indeed become
'>300'.

However, the Sendkeys {tab} doesn't seem to work correctly.  Instead of the
focus going to the NEXT control, it lands on the PREVIOUS control of the
array -- and YES, my tab order is correct.

Code fragment ....

Private Sub Text8_Change(Index As Integer)
    If Text8(Index) = ">" Then
    Text8(Index) = ">300"
    SendKeys "{tab}"
End Sub

Any ideas anyone?

Cheers .... Geoff   :o)



Tue, 11 Feb 2003 03:00:00 GMT  
 SendKeys "{tab}" doesn't work
Greedo

This will do what you want.

Note that it will increment back around to the Text8(0) after reaching the
highest index.

I also added to code so that the contents in the next TextBox is highlited
for an easy typeover -- just in case you wanted it.

Private Sub Text8_Change(Index As Integer)
    Dim x As Integer

    If Text8(Index) = ">" Then
        Text8(Index) = ">300"
        x = (Index + 1) Mod Text8.Count

        ' highlite the next textbox for typeover
        Text8(x).SelStart = 0
        Text8(x).SelLength = Len(Text8(x))

        ' go to the next box
        Text8(x).SetFocus
    End If
End Sub

Michael


Quote:
> Hi ...

> I'm suing VB6.

> My application main form has an array of 60 text controls on it, namely
> text8().

> Common to the controls is the following sub.

> When I type '>' (without the quotes), the textbox contents do indeed
become
> '>300'.

> However, the Sendkeys {tab} doesn't seem to work correctly.  Instead of
the
> focus going to the NEXT control, it lands on the PREVIOUS control of the
> array -- and YES, my tab order is correct.

> Code fragment ....

> Private Sub Text8_Change(Index As Integer)
>     If Text8(Index) = ">" Then
>     Text8(Index) = ">300"
>     SendKeys "{tab}"
> End Sub

> Any ideas anyone?

> Cheers .... Geoff   :o)



Tue, 11 Feb 2003 03:00:00 GMT  
 SendKeys "{tab}" doesn't work
Private Sub Text8_Change(Index As Integer)
     If Text8(Index) = ">" Then
     Text8(Index) = ">300"
     if Index < Text8.Count - 1 Then Text8(Index+1).SetFocus Else
"OtherControl".SetFocus
End Sub


Quote:
> Hi ...

> I'm suing VB6.

> My application main form has an array of 60 text controls on it, namely
> text8().

> Common to the controls is the following sub.

> When I type '>' (without the quotes), the textbox contents do indeed
become
> '>300'.

> However, the Sendkeys {tab} doesn't seem to work correctly.  Instead of
the
> focus going to the NEXT control, it lands on the PREVIOUS control of the
> array -- and YES, my tab order is correct.

> Code fragment ....

> c>

> Any ideas anyone?

> Cheers .... Geoff   :o)



Wed, 12 Feb 2003 03:00:00 GMT  
 SendKeys "{tab}" doesn't work
Thanks ...

Used this technique instead of the Sendkeys {TAB} approach, since it
afforded me more intelligent options re: the 'next' field to 'tab' to.

Geoff   ;o)


Quote:
> Private Sub Text8_Change(Index As Integer)
>      If Text8(Index) = ">" Then
>      Text8(Index) = ">300"
>      if Index < Text8.Count - 1 Then Text8(Index+1).SetFocus Else
> "OtherControl".SetFocus
> End Sub



> > Hi ...

> > I'm suing VB6.

> > My application main form has an array of 60 text controls on it, namely
> > text8().

> > Common to the controls is the following sub.

> > When I type '>' (without the quotes), the textbox contents do indeed
> become
> > '>300'.

> > However, the Sendkeys {tab} doesn't seem to work correctly.  Instead of
> the
> > focus going to the NEXT control, it lands on the PREVIOUS control of the
> > array -- and YES, my tab order is correct.

> > Code fragment ....

> > c>

> > Any ideas anyone?

> > Cheers .... Geoff   :o)



Wed, 12 Feb 2003 03:00:00 GMT  
 SendKeys "{tab}" doesn't work
Maybe you know this already:
SendKeys only works if the FORM-property "KeyPreview" is set to True.
Bert.


Sun, 16 Feb 2003 06:12:59 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. sendkeys "^{TAB}", she no work!

2. Why Does Sendkeys "TAB" NOT work

3. 0 works, "" doesn't

4. sendKeys("{Tab}") to another form

5. SendKeys "{TAB ??}"

6. SendKeys("{TAB}") catches depressed Shift-Key

7. sendkeys "+{TAB}"

8. sendkeys ("tab") on txtBox.maxlength

9. SendKeys "{TAB}"

10. SendKeys "{TAB}"

11. SendKeys "%({TAB})"

12. SendKeys "^{ESC}", 1 to press the start button wont work

 

 
Powered by phpBB® Forum Software