I am trying to make a calculator-style keypad for a form in an app running on the CF. Obviously I don't really want a different routine for each button if I can help it as each one does the same thing. So I tried
Private Sub Number_Handler(ByVal sender As Object, ByVal e As System.EventArgs) Handles _
btnZero.Click, _
btnOne.Click, _
btnTwo.Click, _
btnThree.Click, _
btnFour.Click, _
btnFive.Click, _
btnSix.Click, _
btnSeven.Click, _
btnEight.Click, _
btnNine.Click
'Handles clicking the buttons for all number buttons
If txtNumber.Text = "0" Then
'Text is still zero so just change the text to the number on the button
txtNumber.Text = sender.Text
Else
txtNumber.Text &= sender.Text
End If
End Sub
but the CF doesn't support late binding so I can't use sender.Text as it's an object without a Text property.
Is there another way to do this or have I just got to have a routine for each button?
Thanks in advance
Private Sub Number_Handler(ByVal sender As Object, ByVal e As System.EventArgs) Handles _
btnZero.Click, _
btnOne.Click, _
btnTwo.Click, _
btnThree.Click, _
btnFour.Click, _
btnFive.Click, _
btnSix.Click, _
btnSeven.Click, _
btnEight.Click, _
btnNine.Click
'Handles clicking the buttons for all number buttons
If txtNumber.Text = "0" Then
'Text is still zero so just change the text to the number on the button
txtNumber.Text = sender.Text
Else
txtNumber.Text &= sender.Text
End If
End Sub
but the CF doesn't support late binding so I can't use sender.Text as it's an object without a Text property.
Is there another way to do this or have I just got to have a routine for each button?
Thanks in advance