HighTechTalks DotNet Forums  

Didplay of controls in Groupbox

Visual Studio.net (General) microsoft.public.vsnet.general


Discuss Didplay of controls in Groupbox in the Visual Studio.net (General) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Michel
 
Posts: n/a

Default Didplay of controls in Groupbox - 06-11-2009 , 06:04 AM






Hello,

I want to display a series of controls (Comboboxes) in a Groupbox.
Therefor, I use following code:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim iTop As Integer = 30
Dim cboZoekCriterium As New ComboBox

For iTeller = 1 To 6
With cboZoekCriterium
.Location = New Point(10, iTop)
.Name = "cboZoekCriterium_" & String.Format("{0:0000}", iTeller)
.Size = New Size(250, 20)
End With

GroupBox1.Height = iTop + 40
Me.GroupBox1.Controls.Add(cboZoekCriterium)

iTop = iTop + 40
Next iTeller

End Sub


Can anyone explain me why only the last Combobox is displayed in the
Groupbox? If I change the number of 6 to any other number, again only the
last Combobox is displayed.

Many thanks and greetings,

Michel

Reply With Quote
  #2  
Old   
PvdG42
 
Posts: n/a

Default Re: Didplay of controls in Groupbox - 06-17-2009 , 02:08 PM






"Michel" <Michel (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello,

I want to display a series of controls (Comboboxes) in a Groupbox.
Therefor, I use following code:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim iTop As Integer = 30
Dim cboZoekCriterium As New ComboBox

For iTeller = 1 To 6
With cboZoekCriterium
.Location = New Point(10, iTop)
.Name = "cboZoekCriterium_" & String.Format("{0:0000}", iTeller)
.Size = New Size(250, 20)
End With

GroupBox1.Height = iTop + 40
Me.GroupBox1.Controls.Add(cboZoekCriterium)

iTop = iTop + 40
Next iTeller

End Sub


Can anyone explain me why only the last Combobox is displayed in the
Groupbox? If I change the number of 6 to any other number, again only the
last Combobox is displayed.

Many thanks and greetings,

Michel

How many Combobox objects do you create? (Hint: the answer is ***1***).
You create on object, then manipulate ***1*** object in a loop. How many
objects would you expect to see?

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.