Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the Name of the control?

Status
Not open for further replies.

777axa

Technical User
Jul 30, 2002
48
US
On a form with lots of radio buttons I'm trying to place the name of the clicked button on a label without doing Select Case or If -Then statements.
How to drill down to the name of the clicked control in the controls collection?
I'd like to have something like:
lblName = Sender.xxx.xxxx.name

I've tried sender.gettype.name.tostring but it gives me the name of the type of the control - RadioButton

Thank you.
 
Thanks,
It worked...if you type ID by hand - there is no ID in the dropdown list of Intelicense -why?
On the other hand if Option Strict is ON it undelines it (sender.ID) and gives an error when you click on Build & Browse.

 
Some Properties/Methods etc are not in intellisense , because ?? Microsft doesnt want inexperienced programmers to use them? Anyway there's a configuration option

>>Tool >>Options

Select 'Text Editor' Form the folder list

On the right there's a CheckBox 'Hide advanced members'

Uncheck it and advanced members wil be shown in intellisense.

Note: There are some members that do not show even when this checkbox is uncheked, these members can still be used but you need to find out the names in documentation

2ndNote: If you build your own assemblies with objects that expose members (properties methods) you can hide them with the attribute ComponentModel.EditorBrowsable
 
I think it is because Sender is "AS OBJECT" which does npt have an ID property. If You know the the Sender will always be a control then try
DirectCast(Sender,Control).ID
OR
CType(Sender,Control).ID
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top