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

from Windows Form how do i create a LABEL in code

P: 9
hi there,

I need to be able to generate multiple labels for the use in a Windows form, the quantity of labels would depend on a count, is it possible to generate multiple labels in code? If so how do I define and declare a label?

Could just make a pile of blank labels and set them to invisible ready at my disposal, but I thought surly there must be an easier way in code.

I am working on a project that I need to vary the quantity, size and text of labels, simular to an Event Calendar.


i hope you can help me


Colin
Apr 10 '07 #1
Share this Question
Share on Google+
6 Replies


Expert 5K+
P: 8,434
Believe it or not, this is easier in VB6 than in later versions, since Microsoft in their infinite wisdom decided to remove control arrays after version 6.

(Note, this is my opinion only. I'm a VB6 user. So although I know that control arrays have been removed in VB.Net, it's quite possible there are better ways to achieve the same results.)


In any case, to start we'll need to know what version of VB you are using.
Apr 10 '07 #2

P: 9
ohh, ok.. im using Visual Basic.Net 2003, Version 7.


i hope this helps you
Apr 11 '07 #3

Expert 5K+
P: 8,434
ohh, ok.. im using Visual Basic.Net 2003, Version 7.
i hope this helps you
Well, I don't know VB.Net myself. I've just done a search on key terms "vb create control runtime" at TheScripts, and come up with a ton of links. Here are the first few, but you can just do a bit of searching. It appears that this subject has been covered numerous times.
Create button control at runtime
creating controls at runtime
Create control at runtime with process
How to Create Object at Runtime
Apr 11 '07 #4

iburyak
Expert 100+
P: 1,017
hi there,

I need to be able to generate multiple labels for the use in a Windows form, the quantity of labels would depend on a count, is it possible to generate multiple labels in code? If so how do I define and declare a label?

Could just make a pile of blank labels and set them to invisible ready at my disposal, but I thought surly there must be an easier way in code.

I am working on a project that I need to vary the quantity, size and text of labels, simular to an Event Calendar.


i hope you can help me


Colin
See this discussion it is about a button generation at run time but could be a label which is even easier doesn’t need any events.

http://www.thescripts.com/forum/thread630771.html

Hope it helps.
Good Luck.
Apr 11 '07 #5

P: 9
thanks for that, i guess my biggest trouble was that i didnt know the correct term for what i was trying to create.. the Control Array, now i wont forget it..




thanks again


Colin
Apr 11 '07 #6

Expert 5K+
P: 8,434
thanks for that, i guess my biggest trouble was that i didnt know the correct term for what i was trying to create.. the Control Array, now i wont forget it..
Let us know how it turns out. :)
Apr 11 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.