Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Form to enter an employee name. On button click, I check the entered name for a duplicate already known.

In case of a duplicate entry, an error message is shown. That's OK.

Problem is, if the input is not a duplicate entry, the next Form should be shown. But instead I need to press the corresponding button a second time to achieve that.

below is my code

C#
public static bool duplicatecheck_first_middle_last_name(string firstname, string middlename, string lastname)
      {
          //Data.dc = "NO";
          if (firstname == "MANOHAR" && middlename == "SAMBHAJI" && lastname == "KHILLARE")
          {
              DuplicateData dd = new DuplicateData();
              //dd.MdiParent = (Home.ActiveForm);
              dd.ShowDialog();

              return true;
          }
          else
          {
              // Data.dc  = "YES";
              return false;

          }
      }

button click event
C#
private void btnnext_Click(object sender, EventArgs e)
{
duplicatecheck_first_middle_last_name(txtfirstname.Text, txtmiddlename.Text, txtlastname.Text);
Employee_Personal_Details ep = new Employee_Personal_Detail();                       ep.displayemployeepersonaldetails();
this.Hide();
ep.ShowDialog();

} 
Posted
Comments
[no name] 31-Aug-12 10:51am    
And? Did you mean to ask some sort of a question? How is this a problem?

1 solution

Hi,

First of all, your code for finding duplicate value is incorrect. Why you have specified FirstName,MiddleName and LastName statically. And Instead of checking from code, i suggest you to check such code from Stored Procedure(if you have).

Now come to your actual problem, i can't figure out such issue with your code. try to debug your application by placing breakpoints. through that you can find your issue.

Thanks
-Amit Gajjar
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900