> Dim _index As Integer
'ListBox has a collection of ListItems
'So declared a ListItem and assigned the Text and SelectedValue you are looking for
> Dim _Item As New ListItem(DS_Products1.Tables(0).Rows(selIndex).Item("SupplierCode"))
> _Item.Value = _Item.Text
'IndexOf returns the position if the text just search
> _index = Me.DropDownList1.Items.IndexOf(_Item)
'If not found _index will contain -1, otherwise will contain the position where the text was found in the List
'So here i am setting the selected item to the position i just found.
> DropDownList1.SelectedIndex = _index
'If -1 no item will be selected
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only