By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,112 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

Dynamically name a object?

P: n/a
Hi!

I wonder if it is possible to dynamically name a object (e.g. checkbox,
combox etc.) during runtime.

I know I can create a object during runtime like this:

Me.MyLabel = New Label
Me.Controls.Add(Me.MyLabel)
MyLabel.Text = "This is a label created during runtime."

but I would need to create the objects from a xml file and before reading
the file I have no information how many or what kind of objects (standard
windows framework) are needed.

If it is not possible to dynamically name a object during creation, is there
some other way doing this?

Thanks,
-BA-
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Maybe this will help.
http://windowsforms.net/articles/wfml.aspx
Ken
----------------------
"-BA-" <ba@nospam.com> wrote in message
news:M3**************@reader1.news.jippii.net...
Hi!

I wonder if it is possible to dynamically name a object (e.g. checkbox,
combox etc.) during runtime.

I know I can create a object during runtime like this:

Me.MyLabel = New Label
Me.Controls.Add(Me.MyLabel)
MyLabel.Text = "This is a label created during runtime."

but I would need to create the objects from a xml file and before reading
the file I have no information how many or what kind of objects (standard
windows framework) are needed.

If it is not possible to dynamically name a object during creation, is there
some other way doing this?

Thanks,
-BA-

Nov 21 '05 #2

P: n/a
"-BA-" <ba@nospam.com> schrieb:
I know I can create a object during runtime like this:

Me.MyLabel = New Label
Me.Controls.Add(Me.MyLabel)
MyLabel.Text = "This is a label created during runtime."

but I would need to create the objects from a xml file and before reading
the file I have no information how many or what kind of objects (standard
windows framework) are needed.

If it is not possible to dynamically name a object during creation, is
there some other way doing this


What you cannot do is creating a member variable with the name of the
control at runtime. However, you can store (name, control) pairs in a
'Hashtable', for example.

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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.