|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
creating pictureboxes on the flyI'm trying to fill a form in visual basic .net with pictureboxes Unfortunately, it doesn't work... the boxes don't show Can anyone please help me ? Dim x As Integer = 0 Dim myCollection As List(Of PictureBox) = New List(Of PictureBox) Dim Location As Integer = 50 For x = 0 To 5 Dim myBox As PictureBox = New PictureBox myBox.SetBounds(50, Location * x, 34, 34) myBox.BackColor = Color.Black myBox.BringToFront() myCollection.Add(myBox) myBox = Nothing Next Thanx, John throw in the following:
Me.Controls.Add(MyBox) Thanks, Seth Rowe John Devlon wrote: Show quoteHide quote > Hi, > > I'm trying to fill a form in visual basic .net with pictureboxes > Unfortunately, it doesn't work... the boxes don't show > > Can anyone please help me ? > > > Dim x As Integer = 0 > Dim myCollection As List(Of PictureBox) = New List(Of PictureBox) > Dim Location As Integer = 50 > > For x = 0 To 5 > Dim myBox As PictureBox = New PictureBox > myBox.SetBounds(50, Location * x, 34, 34) > myBox.BackColor = Color.Black > myBox.BringToFront() > myCollection.Add(myBox) > myBox = Nothing > Next > > Thanx, > > John Many thanx,
I just figgerd it out myself... John Show quoteHide quote "rowe_newsgroups" <rowe_em***@yahoo.com> schreef in bericht news:1160138197.330948.161210@i3g2000cwc.googlegroups.com... > throw in the following: > > Me.Controls.Add(MyBox) > > Thanks, > > Seth Rowe > > John Devlon wrote: >> Hi, >> >> I'm trying to fill a form in visual basic .net with pictureboxes >> Unfortunately, it doesn't work... the boxes don't show >> >> Can anyone please help me ? >> >> >> Dim x As Integer = 0 >> Dim myCollection As List(Of PictureBox) = New List(Of PictureBox) >> Dim Location As Integer = 50 >> >> For x = 0 To 5 >> Dim myBox As PictureBox = New PictureBox >> myBox.SetBounds(50, Location * x, 34, 34) >> myBox.BackColor = Color.Black >> myBox.BringToFront() >> myCollection.Add(myBox) >> myBox = Nothing >> Next >> >> Thanx, >> >> John >
Show quote
Hide quote
"John Devlon" <johndev***@hotmail.com> wrote in message Hi,news:LMrVg.114873$Ja3.1615998@phobos.telenet-ops.be... > > Hi, > > I'm trying to fill a form in visual basic .net with pictureboxes > Unfortunately, it doesn't work... the boxes don't show > > Can anyone please help me ? > > > Dim x As Integer = 0 > Dim myCollection As List(Of PictureBox) = New List(Of PictureBox) > Dim Location As Integer = 50 > > For x = 0 To 5 > Dim myBox As PictureBox = New PictureBox > myBox.SetBounds(50, Location * x, 34, 34) > myBox.BackColor = Color.Black > myBox.BringToFront() > myCollection.Add(myBox) > myBox = Nothing > Next > > Thanx, > You need to add your box to the control collection of the form/panel/control it is displayed upon. Robin I found it myself ...
just ad Me.Controls.Add(myBox) It works... John Show quoteHide quote "John Devlon" <johndev***@hotmail.com> schreef in bericht news:LMrVg.114873$Ja3.1615998@phobos.telenet-ops.be... > > Hi, > > I'm trying to fill a form in visual basic .net with pictureboxes > Unfortunately, it doesn't work... the boxes don't show > > Can anyone please help me ? > > > Dim x As Integer = 0 > Dim myCollection As List(Of PictureBox) = New List(Of PictureBox) > Dim Location As Integer = 50 > > For x = 0 To 5 > Dim myBox As PictureBox = New PictureBox > myBox.SetBounds(50, Location * x, 34, 34) > myBox.BackColor = Color.Black > myBox.BringToFront() > myCollection.Add(myBox) > myBox = Nothing > Next > > Thanx, > > John > |
|||||||||||||||||||||||