Databinding in Visual Studio
Before I go and sign up in some other forum to ask my silly questions, I wonder if there are any .NET programmers lurking around here that can help me?
Does anyone know how I can set a default value on a databound combobox? For example, I've bound a combobox to a database with a list of book authors and want the box to say "Select author..." when the form is first loaded.
The closest I can get is to do
and get a blank entry as default. Can't manage to get any text in there though.

Does anyone know how I can set a default value on a databound combobox? For example, I've bound a combobox to a database with a list of book authors and want the box to say "Select author..." when the form is first loaded.
The closest I can get is to do
comboAuthors.SelectedIndex = -1
and get a blank entry as default. Can't manage to get any text in there though.
Nope. Tried googling around but can't find a solution that works.
Hey.
You'll need to insert a "default" value to your item list. Something like this:
You'll need to insert a "default" value to your item list. Something like this:
comboAuthors.Items.Insert(0, new ListItem("Select author...","")); comboAuthors.Items[0].Selected = true;
Tried that
Odd. SelectedIndex = -1 gives a blank default, but if I do
And if I try inserting before the

'VB: comboAuthor.Items.Insert(0, "Select author...") comboAuthor.SelectedIndex = 0Does nothing.
Odd. SelectedIndex = -1 gives a blank default, but if I do
comboAuthor.Items.Insert(0, "Select author...") comboAuthor.SelectedIndex = -1then there's no blank, just the 1st name in the database.
And if I try inserting before the
Me.TbAuthorsTableAdapter.Fill(Me.BooksDataSet.tbAuthors)line instead of after, then I end up with an empty combobox.