Share My Creation Calculator

Attachments

Last edited:
ok, i will wait

i wanted to control the buttons from the keyboard if you press 1 then button1 should do action...
 
found a solution to use my keyboard erel !!
put another textfield and after every click it request focus
this textfield is invisable
now if you click on your keyboard it check what key you pressed and do action

space bar = enter | c = clear | h = history
all other is normal keys

Code: Copy
Sub keyboard_TextChanged (Old As String, New As String)

Dim ch As String
Dim allowedchar As String
allowedchar = "0123456789+*/-. ch"

ch = keyboard.Text

If allowedchar.Contains(ch) Then

    If ch = 0 Then b0_Action

    If ch = 1 OR ch = 2 OR ch = 3 OR ch = 4 OR ch = 5 OR ch = 6 OR ch = 7 OR ch = 8 OR ch = 9 Then
    btn.Text = ch
    keyboardinput = True
    b_Action
    End If

    If ch = "+" Then bpl_Action
    If ch = "/" Then bd_Action
    If ch = "-" Then bmin_Action
    If ch = "*" Then bmal_Action
    If ch = "." Then bp_Action
    If ch = "c" Then bc_Action
    If ch = " " Then bg_Action
    If ch = "h" Then his_Action

End If

keyboard.Text = ""

keyboard.RequestFocus

End Sub
 

Attachments

Last edited:
Nice. You should give all the digit buttons the same id and then handle them with a single sub.
Code: Copy
Sub btnDigit_Action
Dim btn As Button = Sender
'work with btn.Text
End Sub
If you give multiple buttons the same ID how can you later alter the text or properties of an individual button?
 
what i did is that every button has another TAG and with the sender i ask the value from the tag and use it
how i would like to

again: with the sender you catch the button and then ask for the TAG (= any value you want)
 
Back
Top