Home > Net >  The two buttons in the picture the functional integration to a button, the code should be how to wri
The two buttons in the picture the functional integration to a button, the code should be how to wri

Time:09-16


Rookie just on the road, please predecessors

CodePudding user response:

Is the function of the three text boxes, two judgment, is used to judge the verification code for the, button2 is used to determine the user name and password, don't feel good on the interface is thinking of integrated into a button, the modest consult, please correct me,

CodePudding user response:

Consult somehow with some sincerity, copy the code, at least have a picture what happened

CodePudding user response:

refer to the second floor Bridge_go response:
consult somehow with some sincerity, copy the code, at least have a picture what is going on


According to the big though moral violations, the emperor's highest show you
You should answer, put the code 1 above, a direct move to 2, running is satisfied, if not satisfied, then please modify satisfactory,

As to how to modify, do not discuss, this edition is the bully you are original, doubt of your ability and intelligence

CodePudding user response:

reference wanghui0380 reply: 3/f
Quote: refer to the second floor Bridge_go response:

Consult somehow with some sincerity, copy the code, at least have a picture what is going on


According to the big though moral violations, the emperor's highest show you
You should answer, put the code 1 above, a direct move to 2, running is satisfied, if not satisfied, then please modify satisfactory,

As to how to modify, do not discuss this edition, that is the bully you are original, doubt your ability and IQ

Bosses, see how you reply today with "big though moral emperor," who is this:

CodePudding user response:

You this way is the function of a button, in the third button click event calls these two methods

CodePudding user response:

refer to the second floor Bridge_go response:
consult somehow with some sincerity, copy the code, at least have a picture what is going on

Private void button2_Click (object sender, EventArgs e)
{
The String the user, the PWD;
User=textBox1. Text;
The PWD=textBox2. Text;
String myconn=@ "Data Source=FQ - 201807101551; Initial Catalog=data1997; User ID=sa; Password=123 ";
SqlConnection SqlConnection=new SqlConnection (myconn);
SqlConnection. The Open ();
String SQL="select * from the users where name='" + user +"' and PWD='" + PWD + "' ";
SqlCommand SqlCommand=new SqlCommand (SQL, sqlConnection);
SqlDataReader SqlDataReader=sqlCommand. ExecuteReader ();
If (sqlDataReader. HasRows)
{
Form3 Form3=new Form3 ();
Form3. The Show ();
Enclosing the Close ();
}
The else
{
DialogResult Dr=MessageBox. Show (" register new user?" , "login failed", MessageBoxButtons YesNo, MessageBoxIcon. Question);
If (Dr==DialogResult. Yes)
{
Form3 Form3=new Form3 ();
Form3. The Show ();
Enclosing the Close ();
}
The else
{
This. The Show ();
}
}
}
Code 2:
Private void button1_Click (object sender, EventArgs e)
{

If (textBox1 Text!=textBoxText. Text | | textBoxText. Text==String. The Empty)
{
MessageBox. Show (" wrong password, please enter again ");
return;
}

The else
{
Time nt=new time ();
This. Hide ();
Nt. ShowDialog ();
}
}
Sorry, thoughtless, please inclusion

CodePudding user response:

Private void button3_Click (object sender, EventArgs e)
{
The button1_Click (sender, e);
Button2_Click (sender, e);
}

CodePudding user response:

The two buttons of events to choose the same line

CodePudding user response:

Right-click extraction method, call again after packaging

CodePudding user response:

Took a look at this is a login button and register button merger, the first thing you need to record log in information, button display, or for the registration, and then directly according to the button text, judge is what action, if is the web add an attribute to the button, to determine what is also possible
  •  Tags:  
  • C #
  • Related