Employee e2 = new Employee("Burke","Brian","02/02/1972");
Employee e3 = new Employee("Ciccu","Alice","03/03/1973");
al.Add(e1);
al.Add(e2);
al.Add(e3);
Label3.Visible = false;
}
... // Web Form Designer generated code
private void Button1_Click(object sender, System.EventArgs e)
{
ListBox1.Items.Clear();
string filter = TextBox1.Text;
if (RadioButtonList1.SelectedValue == "Last Name")
{
foreach (Employee emp in al)
{
if (emp.last.IndexOf(filter) >= 0)
ListBox1.Items.Add(
emp.last + ", " + emp.first + ", " + emp.dob);
}
}
文章来源于领测软件测试网 https://www.ltesting.net/