Yes, that works - CType(sender, Button).Text) in VB.NET - for a Button.
- but I thought there was something more general, though the .Text property isn't going to be uniform across controls. I'll go for that solution. thx _____ Ian Thomas Victoria Park, Western Australia _____ From: [email protected] [mailto:[email protected]] On Behalf Of Wallace Turner Sent: Friday, March 30, 2012 2:03 PM To: ozDotNet Subject: Re: WinForms - button text from sender object C# ((TextBox)sender).Text ? On 30/03/2012 2:01 PM, Ian Thomas wrote: Hello folks I've forgotten how to get the text from a button click that handles multiple buttons - Private Sub Buttons_Click(ByVal sender As Object, ByVal e As EventArgs) _ Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click (VB.NET above) sender.ToString gives me the whole object description with its .Text property, but what's the simple expression to get just that text? System.Windows.Forms.Button, Text: MyButtonText _____ Ian Thomas Victoria Park, Western Australia
