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

To make dynamic labels

P: 14
hi,


I am making a dynamic form which i have to put some labels which r 2 b dynamic.n i have to make 'n' number of labels dynamically.

label me = new label();

This is the line im using to make it. how do i pass the value of 'n' in the code.
if someone can help me 2 do this.

plz help to do this.
Reply soon........
Feb 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: 20
Hi,
I don' know what language you're using. Here is a version in VB
Expand|Select|Wrap|Line Numbers
  1.         For i As Integer = 0 To n ' as many as you need
  2.             Dim label As New System.Windows.Forms.Label
  3.             Me.SuspendLayout()
  4.             label.Location = New System.Drawing.Point(112, 96 + i * 96) 'you can change the location to your preference, just make sure they don't overlap 
  5.             label.Name = "label" + i.ToString
  6.             label.TabIndex = 0
  7.             label.Text = "label" + i.ToString
  8.             Me.Controls.Add(label)
  9.         Next
  10.  
I hope this helps
Feb 23 '07 #2

P: 14
hi,

Thank u so much 4 the reply but my prob got solved before that. but this was almost wat i wrote but in C#
Feb 26 '07 #3

Post your reply

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