Thursday, February 21, 2008

Selecting an index in a DropDownList

VB.Net


DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue())

'DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText())


I post this because I can never remember how to do this simple thing (happens a lot these days...)

1 comment:

Ben Walling said...

DropDownList1.Items.FindByValue().Selected = True