17-10-12, 05:33 PM
كاتب الموضوع : AhmedEssawy
كود :
'
'txtItem.Text would be a textbox control whose text will be searched. And of
'course, lstItems is a Listbox control or you can make it a Combobox control. The code below
'shows searching for a partial/exact string at either the beginning of the control or at a
'specified Index value.
'
'
'Search a Listbox Control for a exact string
lstItems.SelectedIndex = lstItems.FindStringExact(txtItem.Text)
'
'Search a Listbox Control for a partial string
lstItems.SelectedIndex = lstItems.FindString(txtItem.Text)
'
'Start searching a Listbox Control for a partial string at Index value 4.
lstItems.SelectedIndex = lstItems.FindString(txtItem.Text, 4)
'
'Start searching a Listbox Control for a exact string at Index value 2.
lstItems.SelectedIndex = lstItems.FindStringExact(txtItem.Text, 2)