473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

from Windows Form how do i create a LABEL in code

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
6 8351
Killer42
8,435 Expert 8TB
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
ohh, ok.. im using Visual Basic.Net 2003, Version 7.


i hope this helps you
Apr 11 '07 #3
Killer42
8,435 Expert 8TB
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
1,017 Expert 512MB
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
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
Killer42
8,435 Expert 8TB
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

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

Similar topics

1
by: Robert Skidmore | last post by:
I am building an application that will fade one panel to another panel. Both panels will have picture boxes in them (thumbnails). This is what I have tried: private void...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
4
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
2
by: BG | last post by:
We're having trouble writing the code to update a UI control (label.Text) from a secondary thread. We're using C# with Windows Forms. We have a main form named MainForm, a splash screen form...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
7
by: Jon S via DotNetMonster.com | last post by:
Hi all, I posted this yesterday but didnt explain it too well so thought I would do it again. I have a label on a form that I want to be able to change the text while I'm in a seperate class...
5
by: RSH | last post by:
I havent been able to set a property from another class with out getting some sort of error. Can someone please tell me what I'm doing wrong here? Public Class Form1
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
8
by: BillE | last post by:
When I create a control dynamically and it grows according to the content, the control Height property still returns the original default control height instead of the height after expanding. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.