Click here to Skip to main content
12,504,462 members (53,340 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

821 views
Posted

how to Check if already exists a employer in the list with same code entered in textbox

, 28 Jan 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Hello,I need your help, if it is possibe.I need to check if already exists a employer in the list with same code entered in the textbox.I have a list of employers, and I add employers like this : else if (cb_type.Text == type1.text){ type1 typeone = new...
Hello,

I need your help, if it is possibe.

I need to check if already exists a employer in the list with same code entered in the textbox.

I have a list of employers, and I add employers like this :
else if (cb_type.Text == type1.text)
{
 
     type1 typeone = new typeone(Convert.ToInt32(tb_Code.Text), tb_Name.Text, Convert.ToDateTime(dateTimePicker1.Text), cb_Sex.Text, tb_Adress.Text, Convert.ToInt32(tb_Phone.Text), tb_Email.Text, pictureBox1.Image);
     LEmployer.Add(typeone);
     listBox1.Items.Add(V.getName());
     listBox1.Show();
}
In the moment that i add a new employer i need to verify if already exists a employer with the same code that is entered in textbox.

I try this :
foreach (employer E in Lemployer)
{
      if tb_code.text == E.getCode())
      {
           Messagebox.show("Code Already exists");
      }
}
But this isn't working, someone can help me doing this?

Thanks

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mibetty
Portugal Portugal
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 28 Jan 2013
Article Copyright 2013 by mibetty
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid