Your code loads the combo box just fine. To eliminate the "ComboBox1" text,
either set the SelectedIndex of your combo box to a valid index (e.g. 0 or 1
with your example), which will select one of the values by default, or set
the Text property to an empty string, e.g.
Me.ComboBox1.Items.AddRange(New Object() {"red", "blue"})
Me.ComboBox1.SelectedIndex = 0
or
Me.ComboBox1.Items.AddRange(New Object() {"red", "blue"})
Me.ComboBox1.Text = ""
You can find an example of binding a combobox to a database here:
http://msdn.microsoft.com/library/de...boxcontrol.asp
"James P." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> For my new Windows application, all I want is to create an initial
> form to demo to the user to show them how it looks like with some data
> on it. So I figure the fastest way is to create some comboBox-es to
> show some data on them manually entered in the code without connecting
> to the database yet. It should be simple but somehow I can't make it
> work.
>
> First, I drag a comboBox from the ToolBox to the form. Then,
> double-click the form to go to the code behind page with the Load
> event, I tried either:
>
> ComboBox1.Items.AddRange(New Object() {"red", "blue"})
> OR
> ComboBox1.Items.Add("red")
> ComboBox1.Items.Add("blue")
>
> Yet when I ran, it showed nothing on the comboBox, except the word
> "comboBox1" (default text property). Any ideas what I am missing,
> anybody?
>
> Or if you can tell me how create a comboBox display values from a
> database the quickest way.
>
> Thanks,
> James