Data Bound Combobox SelectedIndex

J

Jeff

Good evening,

I have a form with a data bound combobox and would for when the form loads
that the combobox not have anyvalue showing int he combo box i want the user
to have to select the choice before it returns the dataset info.

MSDN says "You cannot set the SelectedIndex of a ComboBox item to -1 if the
item is a data-bound item"

but that is all it says, is there a way around this?

Not sure if asking the question quit right.

Thanks for the help,

Jeff
 
S

Scott M.

Jeff said:
Good evening,

I have a form with a data bound combobox and would for when the form loads
that the combobox not have anyvalue showing int he combo box i want the
user to have to select the choice before it returns the dataset info.

MSDN says "You cannot set the SelectedIndex of a ComboBox item to -1 if
the item is a data-bound item"

but that is all it says, is there a way around this?

Not sure if asking the question quit right.

Thanks for the help,

Jeff

After the code to data-bind the combobox has executed, simply insert a new
item into the combobox at position 0:

ComboBox.Items.Insert(0,"")

-Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top