Setting DropDownList default question

M

Mike P

Is it possible to set the last item in a DropDownList as the default,
and if so how?
 
J

Jeff Johnson

Is it possible to set the last item in a DropDownList as the default,
and if so how?

There is no such thing as a "default" item in a drop down list. If you
simply want to make the last item in the list the SELECTED item, then do

myListBox.SelectedIndex = myListBox.Items.Count - 1;

This assumes you are using a non-data-bound list. I can't help you with data
binding as I virtually never use it.
 

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