26-07-13, 12:05 AM
اعتقد هذا طلبك
سي شارب :
فيجوال بيسك :
سي شارب :
PHP كود :
int index = -1;
List<string> lstboxItems = new List<string>();
foreach (string Estr in listBox1.Items)
{
lstboxItems.Add(Estr);
}
foreach (string Istr in lstboxItems)
{
if (textBox1.Text.Contains(Istr))
{
index = lstboxItems.IndexOf(Istr);
}
}
if (index == -1)
{
listBox1.SelectedIndex = -1;
}
else
{
listBox1.SelectedIndex = index;
}
فيجوال بيسك :
PHP كود :
Dim index As Integer = -1
Dim lstboxItems As New List(Of String)()
For Each Estr As String In listBox1.Items
lstboxItems.Add(Estr)
Next
For Each Istr As String In lstboxItems
If textBox1.Text.Contains(Istr) Then
index = lstboxItems.IndexOf(Istr)
End If
Next
If index = -1 Then
listBox1.SelectedIndex = -1
Else
listBox1.SelectedIndex = index
End If

