[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • Last Modified:

VB6 Keypad

Basically I have two text boxes and a keypad. I can get the keypad to work with one text box with no problems

Text1.Text = Text1.Text + "1"

What I want the program to do is detect which text box the user has selected so when you click the buttons on they keypad they fill the selected text box. The user can then move onto the next text box and fill that using the keypad.
0
souldigital
Asked:
souldigital
  • 3
  • 2
  • 2
1 Solution
 
IanThCommented:
have you got an on-click event handler setup on the text boxes?
0
 
souldigitalAuthor Commented:
No?
0
 
IanThCommented:
well how are you going to tell which text box the user clicks in as thats what the on-click event handler will do imho
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
souldigitalAuthor Commented:
I don't know hence why I have asked. So what you are suggesting is that I need to look into something called on click event handler?
0
 
LeithauserCommented:
Create a Public or Global integer variable called WhichTextBox. In each textboxes GotFocus sub, put WhichTextBox = 1 or WhichTextBox = 2 and so on.  You can then reference this variable to know which text box last had the focus. You can use indexed text boxes like TextBox(WhichTextBox) to automatically reference them, or use something like Select like this
Select Case WhichTextBox
   Case 1
        Text1.Text=Text1.Text + S$
   Case 2
        Text2.Text=Text2.Text + S$
End Select
where S$ is the keyboard input.
0
 
souldigitalAuthor Commented:
Where do I find GotFocus sub?
0
 
LeithauserCommented:
Double click on the text box.  This will bring up the code for the text box. In the upper right corner of the code form is a drop down list box of the control's Event subs. If you have attached no code to the text box so far, it probably says "Change." Click on the drop down box to see an alphabetical list of all the Event code modules for the text box. GotFocus will be on the list. Just click on it to select that Event sub. Then input the WhichTextBox = 1 or WhichTextBox = 2 (and so on) code into that Event sub.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now