rostamkhani
سه شنبه 10 دی 1387, 03:30 صبح
سلام
من برای جستجوی مقادیر textBox در یک لیست از FindIndex به شکل زیر استفاده کردم.
روش بهتری برای این کار هست ؟
(روشی که مثلا نیاز به متغیر strFind نباشه)
List<string> listInt = new List<string>();
public Form1()
{
InitializeComponent();
listInt.Add("ali");
listInt.Add("reza");
listInt.Add("mohamad");
listInt.Add("sadegh");
listInt.Add("ahmad");
listInt.Add("fazel");
listInt.Add("hasan");
listInt.Add("hosein");
listInt.Add("fazel");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
strFind=textBox1.Text;
this.Text = listInt.FindIndex(FindIndex).ToString();
}
public static string strFind = "";
private static bool FindIndex(String str)
{
if (str == strFind)
{
return true;
}
else
{
return false;
من برای جستجوی مقادیر textBox در یک لیست از FindIndex به شکل زیر استفاده کردم.
روش بهتری برای این کار هست ؟
(روشی که مثلا نیاز به متغیر strFind نباشه)
List<string> listInt = new List<string>();
public Form1()
{
InitializeComponent();
listInt.Add("ali");
listInt.Add("reza");
listInt.Add("mohamad");
listInt.Add("sadegh");
listInt.Add("ahmad");
listInt.Add("fazel");
listInt.Add("hasan");
listInt.Add("hosein");
listInt.Add("fazel");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
strFind=textBox1.Text;
this.Text = listInt.FindIndex(FindIndex).ToString();
}
public static string strFind = "";
private static bool FindIndex(String str)
{
if (str == strFind)
{
return true;
}
else
{
return false;