stephenlecompte
07-20-2003, 08:12 AM
I have three option buttons and one text Box
The name of the 1st one is: Own.
The name of the 2nd one is: United.
The name of the 3rd one is: Mayflower
The name of the text box is: txtBox(5)
On the form they are side by side except for text box which is on the next line.
O Own O United O Mayflower
_____________
|____________| txtBox(5)
My problem is that when I press my ENTER key it acts like a TAB button highlighting the next field. When I press the TAB key it acts like an ENTER button going to the next line. Also, when I choose the ENTER key it not only moves to the next option button - but it changes the value of the previous option it was highlighted and selects the option button that it is currently on. I want these set of commands do the opposite - if the User presses TAB then the option switches over to the next field and selects that one to be highlighted. If the User presses ENTER then the choice is finished and go to the next line which happens to be a text box.
I'm sure it has to do with the KeyUp function...but I'm not sure on the exact format.
P.S. I do understand that the last code under Private Sub Mayf_KeyDown(.....) should say If KeyCode = 9 Then txtBox(5).SetFocus but I changed it to the other because I couldn't figure out why the TAB and ENTER key wasn't working properly.
The following is the code:
Private Sub Own_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 32 Then Call Text_Box
If KeyCode = 13 Then United.SetFocus
End Sub
Private Sub United_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 32 Then Call Text_Box
If KeyCode = 13 Then Mayf.SetFocus
End Sub
Private Sub Mayf_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 32 Then Call Text_Box
If KeyCode = 13 Or KeyCode = 9 Then Own.SetFocus
End Sub
The name of the 1st one is: Own.
The name of the 2nd one is: United.
The name of the 3rd one is: Mayflower
The name of the text box is: txtBox(5)
On the form they are side by side except for text box which is on the next line.
O Own O United O Mayflower
_____________
|____________| txtBox(5)
My problem is that when I press my ENTER key it acts like a TAB button highlighting the next field. When I press the TAB key it acts like an ENTER button going to the next line. Also, when I choose the ENTER key it not only moves to the next option button - but it changes the value of the previous option it was highlighted and selects the option button that it is currently on. I want these set of commands do the opposite - if the User presses TAB then the option switches over to the next field and selects that one to be highlighted. If the User presses ENTER then the choice is finished and go to the next line which happens to be a text box.
I'm sure it has to do with the KeyUp function...but I'm not sure on the exact format.
P.S. I do understand that the last code under Private Sub Mayf_KeyDown(.....) should say If KeyCode = 9 Then txtBox(5).SetFocus but I changed it to the other because I couldn't figure out why the TAB and ENTER key wasn't working properly.
The following is the code:
Private Sub Own_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 32 Then Call Text_Box
If KeyCode = 13 Then United.SetFocus
End Sub
Private Sub United_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 32 Then Call Text_Box
If KeyCode = 13 Then Mayf.SetFocus
End Sub
Private Sub Mayf_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 32 Then Call Text_Box
If KeyCode = 13 Or KeyCode = 9 Then Own.SetFocus
End Sub