Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...