📄 创建用户.cs
字号:
this.groupBox2.Size = new System.Drawing.Size(184, 72);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "性别";
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(96, 24);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(64, 24);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "女";
//
// radioButton1
//
this.radioButton1.AllowDrop = true;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(8, 24);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(64, 24);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "男";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(72, 24);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(128, 23);
this.textBox4.TabIndex = 1;
this.textBox4.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 24);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 24);
this.label6.TabIndex = 0;
this.label6.Text = "姓名";
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 56);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(56, 24);
this.label7.TabIndex = 0;
this.label7.Text = "电话";
//
// label8
//
this.label8.Location = new System.Drawing.Point(216, 56);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(64, 24);
this.label8.TabIndex = 0;
this.label8.Text = "电子邮件";
//
// label9
//
this.label9.Location = new System.Drawing.Point(216, 24);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(56, 24);
this.label9.TabIndex = 0;
this.label9.Text = "地址";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(288, 24);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(128, 23);
this.textBox5.TabIndex = 1;
this.textBox5.Text = "";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(72, 56);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(128, 23);
this.textBox6.TabIndex = 1;
this.textBox6.Text = "";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(288, 56);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(128, 23);
this.textBox7.TabIndex = 1;
this.textBox7.Text = "";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.radioButton3);
this.groupBox3.Controls.Add(this.radioButton4);
this.groupBox3.Location = new System.Drawing.Point(232, 96);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(184, 72);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "状态";
//
// radioButton3
//
this.radioButton3.Checked = true;
this.radioButton3.Location = new System.Drawing.Point(16, 24);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(56, 24);
this.radioButton3.TabIndex = 0;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "活动";
//
// radioButton4
//
this.radioButton4.Location = new System.Drawing.Point(104, 24);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(72, 24);
this.radioButton4.TabIndex = 0;
this.radioButton4.Text = "不活动";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(192, 368);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 32);
this.button1.TabIndex = 5;
this.button1.Text = "保 存";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.Transparent;
this.button2.ForeColor = System.Drawing.Color.White;
this.button2.Location = new System.Drawing.Point(376, 368);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(72, 32);
this.button2.TabIndex = 6;
this.button2.Text = "取 消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// chuangjianyonghu
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(608, 416);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label4);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox3);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "chuangjianyonghu";
this.Text = "创建用户";
this.Load += new System.EventHandler(this.chuangjianyonghu_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void chuangjianyonghu_Load(object sender, System.EventArgs e)
{
this.comboBox1.SelectedItem=0;
}
string ser;
string xingtai;
private void button1_Click(object sender, System.EventArgs e)
{
if(this.radioButton1.Checked)
{
ser=this.radioButton1.Text;
}
if(this.radioButton2.Checked)
{
ser=this.radioButton2.Text;
}
if(this.radioButton3.Checked)
{
xingtai=this.radioButton3.Text;
}
if(this.radioButton4.Checked)
{
xingtai=this.radioButton4.Text;
}
if(this.textBox1.Text==""||this.textBox2.Text==""||this.textBox4.Text=="")
{
MessageBox.Show("请填完","信息");
}
else if(this.textBox2.Text!=this.textBox3.Text)
{
MessageBox.Show("两次密码不对!","信息");
}
else
{
string stl="Provider=Microsoft.Jet.OLEDB.4.0;Data source=hua.mdb";
OleDbConnection con=new OleDbConnection(stl);
con.Open();
string str="insert into ws values('"+this.textBox1.Text+"','"+this.textBox2.Text+"','"+this.comboBox1.Text+"','"+this.textBox4.Text+"','"+this.textBox5.Text+"','"+this.textBox6.Text+"','"+this.textBox7.Text+"','"+ser+"','"+xingtai+"')";
OleDbCommand an=new OleDbCommand(str,con);
int num=an.ExecuteNonQuery();
if(num==1)
{
MessageBox.Show("注册成功","信息");
this.textBox1.Text="";
this.textBox2.Text="";
this.textBox3.Text="";
this.textBox4.Text="";
this.textBox5.Text="";
this.textBox6.Text="";
this.textBox7.Text="";
}
}
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Hide();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -