Using array buttons

using visual Basic

How can i program an array button so that it can be used to enter text into a field as well as a number.

for example the number 2 button enters "2" into the field and also when requested can enter "A" or "B" or "C"
thank you
Matt_leeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
marginalConnect With a Mentor Commented:
In a new form put a array of Command1 buttons, then create Two TextBoxes (Text1 and Text2)
Text1 will recive alphabet letter and Text2 will recive the Index number

Code:

Private Sub Command1_Click(index as integer)
   
      'If you want to write A when you push Command1(1).
     
    If Index >= 1 And Index <= 28 Then
        Text1.Text= Char$(Index+47)
    Else
        Text2.Text = CStr(Index)
    End If
End Sub

I hope That help
                      MarginaL
0
 
Matt_leeAuthor Commented:
Edited text of question.
0
 
VbmasterCommented:
In the Click event you can check the value of the variable Index to see which button was pressed.
0
 
grooneCommented:
I think this is what you may want.
You are simply turning the information from the text box or what ever and turning it into a variant.
Then you figure the ascii value of the first character and it add or place next to one another.

Private Sub Command2_Click()
    Dim tmp As Variant, tmpAsc As Integer
       
    tmp = CVar(Text1.Text)
    tmpAsc = Asc(tmp)
   
    If tmpAsc >= 48 And tmpAsc <= 57 Then
        tmp = tmp + 5
    Else
        tmp = tmp & "5"
    End If
   
    Text1 = CStr(tmp)
End Sub
0
 
grooneCommented:
Thats not what he was asking to do.  Sorry, but that isnt the right answer
0
All Courses

From novice to tech pro — start learning today.