davidh Posted September 25, 2003 Posted September 25, 2003 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 Quote
*Gurus* divil Posted September 25, 2003 *Gurus* Posted September 25, 2003 You have to cast it, just like you should be doing with the regular framework (put option strict on). DirectCast(sender, TextBox).Text = "blah" Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.