iitk Posted November 25, 2003 Posted November 25, 2003 I am writing a handler for a button click event in the compact .NET framework. You have the two arguments object and eventarguments. What I need is the caption of the button... but I can't work out how to get it :( Any clues gratefully accepted!! Dom Quote
bpayne111 Posted November 25, 2003 Posted November 25, 2003 string text = Button1.Text; C# Dim text as string = Button1.Text VB is that what you are looking for? Quote i'm not lazy i'm just resting before i get tired.
iitk Posted November 25, 2003 Author Posted November 25, 2003 Not quite as easy as that I'm afraid... The .NET framework doesn't allow late binding so I cannot pickup information such as eventsender.text There must be some way of getting the caption on the button inside its own click event!! Even in the cut down compact framework!! :eek: Quote
*Experts* mutant Posted November 25, 2003 *Experts* Posted November 25, 2003 You have to cast the sender object that is passed in to a button type. Then after casting you can access the properties of the button. To cast, use the DirectCast keyword. DirectCast(sender, Button).Text = "some text" Quote
iitk Posted November 25, 2003 Author Posted November 25, 2003 Perfect... I knew I was being foolish somewhere down the line!! :D Quote
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.