Help! Need help with TextBox Cntrl 
Author Message
 Help! Need help with TextBox Cntrl

I'm just trying to get a return key to advance to the next TextBox
or object.

Even when I get close, I still get an annoying bell.

Anyone have any advice?



Thu, 29 Apr 1999 03:00:00 GMT  
 Help! Need help with TextBox Cntrl

try this

    Character = Chr(KeyAscii)

            If Character = Chr$(13) Then
            Textn(nn).SetFocus
            End If



Quote:

> I'm just trying to get a return key to advance to the next TextBox
> or object.

> Even when I get close, I still get an annoying bell.

> Anyone have any advice?



Thu, 29 Apr 1999 03:00:00 GMT  
 Help! Need help with TextBox Cntrl



Quote:

> I'm just trying to get a return key to advance to the next TextBox
> or object.

> Even when I get close, I still get an annoying bell.

> Anyone have any advice?

This is something that one of my clients wanted.

To finanally get rid of that bell.... you must first turn off the "default"
property in all objects.
This property tells an object to "steal" the return key so that you can use
return to "Enter a form"
Only one object should have it set to true.  Most likly the first command
button you put on the screen.
Once you do that the, ascii value of 13 is returned in the key down (I
think) method of the object with the
focus.  then you can do ->   txtNextField.Setfocus.

Here is a good reason not to do this:

Once I had the program writen for my client.  He never stoped complaning
that the return key in his other
windows application didn't work!!!  So I would sugest that you use windows
the way windows wants you to.

                Scott.



Thu, 29 Apr 1999 03:00:00 GMT  
 Help! Need help with TextBox Cntrl

Thanks for all the help...

Another person had suggested this, and works fine for a TextBox Control.

Private Sub Input_KeyPress(KeyAscii As Integer)

    If KeyAscii = 13 Then
        KeyAscii = 0
        sendkeys "{TAB}"
    End If

End Sub

The KeyAscii = 0 is the best way I've seen to get rid of the bell.

Again thanks for everyone's help.



Thu, 29 Apr 1999 03:00:00 GMT  
 Help! Need help with TextBox Cntrl

Quote:

> I'm just trying to get a return key to advance to the next TextBox
> or object.

> Even when I get close, I still get an annoying bell.

> Anyone have any advice?

My advice would be to stick to the Common User Access standard which
Windows abides by, and use Tab to move between controls and Enter to
activate the default command button, if any.  What you are trying to do
is make Windows behave like a dumb terminal interface.

If you have good reasons for wanting to do this, you might want to do it
the way a colleague did.  He defined a default command button which
would simulate pressing the Tab key by checking a form-wide variable set
by each control so as to determine which control had the focus before
the command button was pressed, and a Select Case statement to decide
which control to set the focus to.  This doesn't implement Shift-Tab,
but does work reasonably well.



Sat, 01 May 1999 03:00:00 GMT  
 Help! Need help with TextBox Cntrl

Quote:


> > I'm just trying to get a return key to advance to the next TextBox
> > or object.

> > Even when I get close, I still get an annoying bell.

> > Anyone have any advice?

> My advice would be to stick to the Common User Access standard which
> Windows abides by, and use Tab to move between controls and Enter to
> activate the default command button, if any.  What you are trying to do
> is make Windows behave like a dumb terminal interface.

> If you have good reasons for wanting to do this, you might want to do it
> the way a colleague did.  He defined a default command button which
> would simulate pressing the Tab key by checking a form-wide variable set
> by each control so as to determine which control had the focus before
> the command button was pressed, and a Select Case statement to decide
> which control to set the focus to.  This doesn't implement Shift-Tab,
> but does work reasonably well.I dunno if this is what you are after but here goes anyway

to make the enter key act like the tab key use this bit of code in the
key press event of the text box you are using

    If KeyAscii = 13 Then
       SendKeys "{tab}"
       KeyAscii = 0
    End If

--
+-------------------------------------+
|Visit My Web Site :                  |
| http://www.aston.ac.uk/~dalyam      |
+-------------------------------------+



Wed, 05 May 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. help, help, help...I'm begging here :-\ RE RE POST simple code help needed

2. help,help,help,help,help,help,help,help,help,help,help,help,help,

3. HELP HELP HELP, Need help, in IE Control

4. Textbox Help Needed

5. Need help in formatting dates in textbox

6. need help with textbox validation problem

7. Newbie Needs Help on Textbox

8. Newbie needs help with TextBox

9. Desparately need Help! (Textbox on Picturebox)

10. Printing Multiline Textbox Help Needed.

11. textbox help needed

12. Newbie needs help with Loop to textBox

 

 
Powered by phpBB® Forum Software