Solved

VB6 Keypad

Posted on 2010-09-19
7
764 Views
Last Modified: 2012-05-10
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
Comment
Question by:souldigital
  • 3
  • 2
  • 2
7 Comments
 
LVL 30

Expert Comment

by:IanTh
ID: 33710829
have you got an on-click event handler setup on the text boxes?
0
 

Author Comment

by:souldigital
ID: 33710965
No?
0
 
LVL 30

Expert Comment

by:IanTh
ID: 33711028
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:souldigital
ID: 33711061
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
 
LVL 5

Accepted Solution

by:
Leithauser earned 500 total points
ID: 33711227
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
 

Author Comment

by:souldigital
ID: 33712029
Where do I find GotFocus sub?
0
 
LVL 5

Expert Comment

by:Leithauser
ID: 33712055
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 53
Excel - Save a copy of work book 13 89
Exit a vb6 apps when a calling it apps closes 15 52
Collapse and expand table in Word 2010 2 36
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question