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

Creating Label Array

P: n/a
Hi
In VB6 if you copied and then past a control it asked you if you want to
create an array dotnet doesn't!

I want to create an array of Labels at design time not runtime can this be
done in VB dotnet?

If so how?

thanks
Nov 21 '05 #1
Share this Question
Share on Google+
10 Replies

P: n/a
Not that I know of.

Stefan

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi
In VB6 if you copied and then past a control it asked you if you want to
create an array dotnet doesn't!

I want to create an array of Labels at design time not runtime can this be
done in VB dotnet?

If so how?

thanks

Nov 21 '05 #2

P: n/a
July 24, 2005

Actually I have heard that when pasting controls, it AUTOMATICALLY creates
a collection. I'm not sure how you access the collection, but supposedly it
creates one itself.....

--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.39.42.23
Static IP


"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi
In VB6 if you copied and then past a control it asked you if you want to
create an array dotnet doesn't!

I want to create an array of Labels at design time not runtime can this be
done in VB dotnet?

If so how?

thanks

Nov 21 '05 #3

P: n/a
OK What I'm trying to do is put a load of data in to a matrix 16 lines/rows
by 10 columns. I just want to be able to run a simple for next loop that
will be used to control what row it goes to and within the loop it will post
the data to cell 1 -10 (or 0 - 9).

I have tried using the datagrid and the listview, but can not get them to
work in this manner so I was just going to create an array, is there a
better way ?

the rows and columns need to be aligned and I would like to alternate each
rows background colour

thanks

"Joseph Bittman MCAD" <Ry*********@msn.com> wrote in message
news:ed**************@TK2MSFTNGP15.phx.gbl...
July 24, 2005

Actually I have heard that when pasting controls, it AUTOMATICALLY creates
a collection. I'm not sure how you access the collection, but supposedly
it creates one itself.....

--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.39.42.23
Static IP


"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi
In VB6 if you copied and then past a control it asked you if you want to
create an array dotnet doesn't!

I want to create an array of Labels at design time not runtime can this
be done in VB dotnet?

If so how?

thanks


Nov 21 '05 #4

P: n/a
Adrian,

Does this little sample gives you an idea for your question (you can use of
course as well labels)?

\\\Needs only a new form and pasting this beneath in
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To 5
Dim bt As New Button
bt.Location = New Drawing.Point(8, 8 + i * 24)
bt.TabIndex = i
bt.Text = i.ToString
bt.Tag = i.ToString
AddHandler bt.Click, AddressOf ClickButton
Controls.Add(bt)
Next
End Sub
Private Sub ClickButton(ByVal sender As Object, _
ByVal e As EventArgs)
MessageBox.Show("Clicked was " & _
DirectCast(sender, Button).Tag.ToString)
End Sub
///
I hope this helps a little bit?

Cor
Nov 21 '05 #5

P: n/a
Does this help a little bit, no it helps a LOT

Thanks
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uD**************@TK2MSFTNGP14.phx.gbl...
Adrian,

Does this little sample gives you an idea for your question (you can use
of course as well labels)?

\\\Needs only a new form and pasting this beneath in
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To 5
Dim bt As New Button
bt.Location = New Drawing.Point(8, 8 + i * 24)
bt.TabIndex = i
bt.Text = i.ToString
bt.Tag = i.ToString
AddHandler bt.Click, AddressOf ClickButton
Controls.Add(bt)
Next
End Sub
Private Sub ClickButton(ByVal sender As Object, _
ByVal e As EventArgs)
MessageBox.Show("Clicked was " & _
DirectCast(sender, Button).Tag.ToString)
End Sub
///
I hope this helps a little bit?

Cor

Nov 21 '05 #6

P: n/a
Just one other thing on this, if I now want to redirect the out put i.e I
want to create the controls not on form1 but on a tab control on form1 how
do I do that?

thanks

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Does this help a little bit, no it helps a LOT

Thanks
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uD**************@TK2MSFTNGP14.phx.gbl...
Adrian,

Does this little sample gives you an idea for your question (you can use
of course as well labels)?

\\\Needs only a new form and pasting this beneath in
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To 5
Dim bt As New Button
bt.Location = New Drawing.Point(8, 8 + i * 24)
bt.TabIndex = i
bt.Text = i.ToString
bt.Tag = i.ToString
AddHandler bt.Click, AddressOf ClickButton
Controls.Add(bt)
Next
End Sub
Private Sub ClickButton(ByVal sender As Object, _
ByVal e As EventArgs)
MessageBox.Show("Clicked was " & _
DirectCast(sender, Button).Tag.ToString)
End Sub
///
I hope this helps a little bit?

Cor


Nov 21 '05 #7

P: n/a
Adrian,

the only thing that change than is
Controls.Add(bt)


tabpage1.Controls.add(bt)

I hope this helps,

Cor
Nov 21 '05 #8

P: n/a
Great thanks again
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
Adrian,

the only thing that change than is
Controls.Add(bt)


tabpage1.Controls.add(bt)

I hope this helps,

Cor

Nov 21 '05 #9

P: n/a
Could I just ask how I can remove them also?

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Great thanks again
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
Adrian,

the only thing that change than is
> Controls.Add(bt)


tabpage1.Controls.add(bt)

I hope this helps,

Cor


Nov 21 '05 #10

P: n/a
Sorry Found it
TabPage1.Controls.Clear()

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
Could I just ask how I can remove them also?

"Adrian" <Ad****@nospamhotmail.com.uk> wrote in message
news:dc**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Great thanks again
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
Adrian,

the only thing that change than is
>> Controls.Add(bt)

tabpage1.Controls.add(bt)

I hope this helps,

Cor



Nov 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.