What was designer of DropDownList smoking?

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
 
A

Andrew de la Harpe

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

still a lot of typing but at least it's only one line !!
Andrew
 
J

John Saunders

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top