Adding values to a combo box

mak2gd

Member
Joined
Jul 9, 2005
Messages
15
Location
Hartford, USA
Programming Experience
5-10
Adding values to a combo box (Resolved)

Hi,
You will tell from this question that I am a VB .Net starter :) I am trying to add a list of ten numbers in the combo box values. I think I have the code right but I think I am placing it in the wrong place. I tried form_load and an add button but neither worked. Can you please help?

Thanks
 
Last edited:
This is just a sample. Try putting it into any of the button

VB.NET:
For i As Integer = 1 To 10
    With ComboBox1
    .Items.Add(i)
    End With
Next

Hope this helps
 
ayzzhero's code worked fine. I had this piece of code but it did not work. Can anyone spot the error?

Me
.ComboBox1.Items.Clear()
Dim x As Integer

For x = 1 To x = 10 Step 1

Me.ComboBox1.Items.Add(x)

Next

Thanks
 
Back
Top