all groups > dotnet windows forms > may 2005 >
You're in the

dotnet windows forms

group:

dynamically Refernce control


dynamically Refernce control KentG
5/31/2005 11:00:03 PM
dotnet windows forms:
I want to build a reference to a WinForms control but I can't seem to do it...

I want to do something like (I know this is wrong):

me.Controls("Textbox" & i).Text = "Hello World!"

But I can't seem to figure it out. Please help.

Re: dynamically Refernce control YangHua
6/1/2005 12:00:00 AM
in c#, you can change this to:

((TextBox)this.Controls("Textbox" & i)).Text = "Hello World!"

i think vb.net will be alike.

"KentG" <KentG@discussions.microsoft.com> дÈëÓʼþ
news:04620064-56E0-4CF0-A88F-57861BDAA897@microsoft.com...
[quoted text, click to view]

Re: dynamically Refernce control Herfried K. Wagner [MVP]
6/1/2005 12:00:00 AM
"KentG" <KentG@discussions.microsoft.com> schrieb:
[quoted text, click to view]

Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
AddThis Social Bookmark Button