Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

how can I get the names of my buttons etc.

of a user-control while running the program?

 

I know it is possible via reflection.

 

E.g.: I call a method in a user-control and here

I want to check, whether it has a button

called "btnXY".

Greetings,

 

Toni.

  • *Experts*
Posted

If you are looking for the name of a control then you don't reflection. Simply going through all the controls in your usercontrol and checking the name will do the job:

For Each ctrl As Control In UserControl11.Controls
     If ctrl.Name = "btnXY" Then
         'there is a control with that name
     End If
Next

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