PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms dynamically Refernce control

Reply

dynamically Refernce control

 
Thread Tools Rate Thread
Old 01-06-2005, 07:00 AM   #1
=?Utf-8?B?S2VudEc=?=
Guest
 
Posts: n/a
Default dynamically Refernce control


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.

Kent.
  Reply With Quote
Old 01-06-2005, 10:29 AM   #2
YangHua
Guest
 
Posts: n/a
Default Re: dynamically Refernce control

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



  Reply With Quote
Old 01-06-2005, 11:21 AM   #3
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
Default Re: dynamically Refernce control

"KentG" <KentG@discussions.microsoft.com> schrieb:
>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!"


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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off