What was designer of DropDownList smoking?

  • Thread starter Thread starter idog
  • Start date Start date
I

idog

arrrrgh!

Is there a better way? This is what I'm currently using (oh my aching
fingers):

cboState.SelectedItem.Selected = False
cboState.Items.FindByValue("CA").Selected = True

thanks,

idog
 
cboState.SelectedIndex =
cboState.Items.IndexOf(cboState.Items.FindByValue("CA") )

still a lot of typing but at least it's only one line !!
Andrew
 
idog said:
arrrrgh!

Is there a better way? This is what I'm currently using (oh my aching
fingers):

cboState.SelectedItem.Selected = False
cboState.Items.FindByValue("CA").Selected = True

Private Sub SelectOne(li as ListItem, list as DropDownList)
list.SelectedItem.Selected = False
li.Selected = True
End Sub

Private Sub SelectFoundItem(list as DropDownList, item As String)
SelectOne(list.Items.FindByValue(item), list)
End Sub

' Then:
SelectFoundItem(cboState, "CA") ' Less typing
 
Back
Top