Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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:

  • *Experts*
Posted

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"

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...