Re: Didplay of controls in Groupbox

Giganews Newsgroups
Subject: Re: Didplay of controls in Groupbox
Posted by:  PvdG42 (pv…@toadstool.edut)
Date: Wed, 17 Jun 2009

"Michel" <Mich…@discussions.microsoft.com> wrote in message
news:64F06D72-D957-4E23-A47D-36903B4052…@microsoft.com...
> 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?

Replies

None

In response to

Didplay of controls in Groupbox posted by Michel on Thu, 11 Jun 2009