vb.net - How do I refer to a windows form control by name (C# / VB) -


Suppose that I have control of a label on a Windows application called "Username". How do I programmatically refer to that label using the label name?

For example, I can:

  as a control in the tab page for each tab. Controls: if ctrl.Name = "user name" then 'something end if next  

is quite incomplete I would like to do something like this:

  TabPage .Controls ("UserName"). I did some googling but couldn 't get a satisfactory answer. Most suggested looping, some said. Net 2005 does not support refining directly by using the string name, and FindControl method asp.net only ...  

Edit

Thanks for yet, here's a more detail.

I have a window with three taboos, which are similar to all designs and functions, I respond in a similar manner to drop down menus, labels, events, etc. in the same way.

Instead of writing code for each event per tagpage, I have created a class that controls events etc. on the tab page.

For example, on each tab page there is a label called "Recurcture" which only shows the number of rows in the DataGride view, when it comes in the selection of a variable in a drop down menu.

So what do I want to be able to do, after selecting a variable in the drop down menu, the DataGrade creates itself with visual data, and then I only have one label ("RecordContor" in the rows I want to show the numbers)).

This is the same process on each tabpad, so what I'm doing is going through the taben of the class and then I want to refer to the "recordconter" and then I can update it. / P>

In my class, I have set ActivePage property for the tab page that the user has chosen and then want to be able to do something like this:

  ActivePage.RecordCounter. Text = GetNumberOfRows ()  

You should be able to use ( ) :

  tab page. Control. Search ("user name", fa lse);  

It searches all the hair controls and returns an array of people matching the string. If you specify true for 2 commands, then it will also see through the controls of the hair control.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -