|
-
May 3rd, 2005, 04:11 PM
#1
Thread Starter
Member
Virtual Numpad [RESOLVED]
I have a touchscreen application that I would like to add a virtual numpad too. The user selects a button for "Keyboard" and a small form is loaded in front of the main form. I've already built the small form with the buttons for all the numbers, but I'm having trouble getting the value to the main form. I'm using something like:
Code:
Private Sub btn1_Click()
frmMain.mskItem.SetFocus
SendKeys , "1"
End Sub
...is there a method for not changing the focus really quickly to main form?
Last edited by Heprox; May 5th, 2005 at 06:03 PM.
-
May 3rd, 2005, 04:28 PM
#2
Re: Virtual Numpad
cant you just do this
VB Code:
frmMain.mskItem.Text = "1"
casey.
-
May 3rd, 2005, 04:37 PM
#3
Thread Starter
Member
Re: Virtual Numpad
Didn't work, I just got the invalid argument error. Plus, I'm pretty sure that would cause the numbers to replace one another?
Last edited by Heprox; May 3rd, 2005 at 04:42 PM.
-
May 3rd, 2005, 09:18 PM
#4
Lively Member
Re: Virtual Numpad
Here is my reccomendation: I am assuming that mskItem is a Masked Edit Control
Create a Command Button Array from 0 to 9. Set the caption to their Index: i.e. caption of cmdNum(0) is "0" and caption of cmdNum(9) is "9". Now, use this code to add the number clicked to mskItem
VB Code:
Private Sub cmdNum_Click(Index As Integer)
frmMain.mskItem.Text = frmMain.mskItem.Text + cmdNum(Index).Caption
End Sub
-
May 3rd, 2005, 09:33 PM
#5
Re: Virtual Numpad
Don't use the + symbol for strings. Use & instead.
VB Code:
Private Sub cmdNum_Click(Index As Integer)
frmMain.mskItem.Text = frmMain.mskItem.Text & cmdNum(Index).Caption
End Sub
-
May 3rd, 2005, 10:07 PM
#6
Lively Member
-
May 4th, 2005, 03:08 PM
#7
Thread Starter
Member
Re: Virtual Numpad
I ended up using a public function that could be called from the keypad form however I can't seem to get the masked edit box to take the strings correctly? Tha values from the keypad form are being passed correctly but I keep getting "invalid property" errors on the string handling.
Code:
Public Sub KeypadSelection(Value As Integer)
' code to change the approriate control
Select Case Value
Case 0
mskItem.Text = mskItem.Text + "0"
Case 1
mskItem.Text = mskItem.Text & "1"
Case 2
mskItem.Text = mskItem.Text & "2"
Case 3
mskItem.Text = mskItem.Text & "3"
Case 4
mskItem.Text = mskItem.Text & "4"
Case 5
mskItem.Text = mskItem.Text & "5"
Case 6
mskItem.Text = mskItem.Text & "6"
Case 7
mskItem.Text = mskItem.Text & "7"
Case 8
mskItem.Text = mskItem.Text & "8"
Case 9
mskItem.Text = mskItem.Text & "9"
End Select
End Sub
-
May 4th, 2005, 03:10 PM
#8
Re: Virtual Numpad
Why are you using a maskedit box? couldn't you use a regular textbox?
what mask are you using?
-
May 4th, 2005, 03:16 PM
#9
Thread Starter
Member
Re: Virtual Numpad
Normally I would use a standard textbox, I just like the visual aid that a mask provides for users. I'll try this one with a standard textbox...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|