Results 1 to 9 of 9

Thread: Virtual Numpad [RESOLVED]

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43

    Question 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.

  2. #2
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Virtual Numpad

    cant you just do this
    VB Code:
    1. frmMain.mskItem.Text = "1"

    casey.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43

    Question 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.

  4. #4
    Lively Member
    Join Date
    Apr 2005
    Posts
    68

    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:
    1. Private Sub cmdNum_Click(Index As Integer)
    2.     frmMain.mskItem.Text = frmMain.mskItem.Text + cmdNum(Index).Caption
    3. End Sub

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Virtual Numpad

    Don't use the + symbol for strings. Use & instead.
    VB Code:
    1. Private Sub cmdNum_Click(Index As Integer)
    2.     frmMain.mskItem.Text = frmMain.mskItem.Text & cmdNum(Index).Caption
    3. End Sub

  6. #6
    Lively Member
    Join Date
    Apr 2005
    Posts
    68

    Re: Virtual Numpad

    Oops, sorry, typo!

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43

    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

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Virtual Numpad

    Why are you using a maskedit box? couldn't you use a regular textbox?

    what mask are you using?

  9. #9

    Thread Starter
    Member
    Join Date
    Nov 2001
    Posts
    43

    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
  •  



Click Here to Expand Forum to Full Width