formmm.jpg public partial class Form1 : Form
{
public string li;
public string li2;
public Form1()
{
InitializeComponent();
}
private void ButtonVOROOD_Click(object sender, EventArgs e)
{
if (TextBoxNAM.Text == "" || TextBoxFAMIL.Text == "" || TextBoxTEL.Text == "")
{
label5.Visible = true;
this.label5.Text = "لطفا فیلدهای فوق را وارد کنید";
}
else
{
List<string> s = new List<string>() { TextBoxNAM.Text, TextBoxFAMIL.Text, TextBoxTEL.Text };
ListViewItem a = new ListViewItem(s.ToArray());
ListView1.Items.Add(a);
TextBoxNAM.Text = "";
TextBoxFAMIL.Text = "";
TextBoxTEL.Text = "";
label5.Visible = false;
//int dd = ListView1.Items.Count;
//label8.Text = dd.ToString();
}
}
private void TextBoxSEARCH_TextChanged(object sender, EventArgs e)
{
if (TextBoxSEARCH.Text != "")
{
for (int i = 0; i < ListView1.Items.Count; i++)
{
for (int j = 0; j < ListView1.Columns.Count; j++)
{
li = ListView1.Items[i].SubItems[j].Text;
bool a = li.Contains(TextBoxSEARCH.Text);
if (a == true)
{
// li = ListView1.Items[i].SubItems[j].Text;
ListView2.Items.Add(li);
}
}
}
}
else
{
ListView2.Items.Clear();
}
}
private void TextBoxSEARCH_TextChanged_1(object sender, EventArgs e)
{
}
}
}