📄 mainform.cs
字号:
}
else
{
MessageBox.Show("请输入正整数","提示");
this.textBox11.Text = "0";
}
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox11.Text = "0";
}
}
private void textBox13_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox13.Text.ToString().Trim());
float t2 = float.Parse(textBox14.Text.ToString().Trim());
float t3 = float.Parse(textBox15.Text.ToString().Trim());
float t4 = float.Parse(textBox16.Text.ToString().Trim());
float t5 = float.Parse(textBox17.Text.ToString().Trim());
float t6 = float.Parse(textBox18.Text.ToString().Trim());
float all = t1 + t2 + t3 + t4 + t5 + t6;
textBox19.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show(e1.Message, "请输入数字");
this.textBox13.Text = "0";
}
}
private void textBox14_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox13.Text.ToString().Trim());
float t2 = float.Parse(textBox14.Text.ToString().Trim());
float t3 = float.Parse(textBox15.Text.ToString().Trim());
float t4 = float.Parse(textBox16.Text.ToString().Trim());
float t5 = float.Parse(textBox17.Text.ToString().Trim());
float t6 = float.Parse(textBox18.Text.ToString().Trim());
float all = t1 + t2 + t3 + t4 + t5 + t6;
textBox19.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox14.Text = "0";
}
}
private void textBox15_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox13.Text.ToString().Trim());
float t2 = float.Parse(textBox14.Text.ToString().Trim());
float t3 = float.Parse(textBox15.Text.ToString().Trim());
float t4 = float.Parse(textBox16.Text.ToString().Trim());
float t5 = float.Parse(textBox17.Text.ToString().Trim());
float t6 = float.Parse(textBox18.Text.ToString().Trim());
float all = t1 + t2 + t3 + t4 + t5 + t6;
textBox19.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox15.Text = "0";
}
}
private void textBox16_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox13.Text.ToString().Trim());
float t2 = float.Parse(textBox14.Text.ToString().Trim());
float t3 = float.Parse(textBox15.Text.ToString().Trim());
float t4 = float.Parse(textBox16.Text.ToString().Trim());
float t5 = float.Parse(textBox17.Text.ToString().Trim());
float t6 = float.Parse(textBox18.Text.ToString().Trim());
float all = t1 + t2 + t3 + t4 + t5 + t6;
textBox19.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox16.Text = "0";
}
}
private void textBox17_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox13.Text.ToString().Trim());
float t2 = float.Parse(textBox14.Text.ToString().Trim());
float t3 = float.Parse(textBox15.Text.ToString().Trim());
float t4 = float.Parse(textBox16.Text.ToString().Trim());
float t5 = float.Parse(textBox17.Text.ToString().Trim());
float t6 = float.Parse(textBox18.Text.ToString().Trim());
float all = t1 + t2 + t3 + t4 + t5 + t6;
textBox19.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox17.Text = "0";
}
}
private void textBox18_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox13.Text.ToString().Trim());
float t2 = float.Parse(textBox14.Text.ToString().Trim());
float t3 = float.Parse(textBox15.Text.ToString().Trim());
float t4 = float.Parse(textBox16.Text.ToString().Trim());
float t5 = float.Parse(textBox17.Text.ToString().Trim());
float t6 = float.Parse(textBox18.Text.ToString().Trim());
float all = t1 + t2 + t3 + t4 + t5 + t6;
textBox19.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox18.Text = "0";
}
}
private void textBox12_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox12.Text.ToString().Trim());
float t2 = float.Parse(textBox19.Text.ToString().Trim());
float all = t1 - t2;
textBox20.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox12.Text = "0";
}
}
private void textBox19_TextChanged(object sender, EventArgs e)
{
try
{
float t1 = float.Parse(textBox12.Text.ToString().Trim());
float t2 = float.Parse(textBox19.Text.ToString().Trim());
float all = t1 - t2;
textBox20.Text = all.ToString().Trim();
}
catch (FormatException e1)
{
MessageBox.Show("请输入数字", "提示");
this.textBox19.Text = "0";
}
}
SqlConnection con = new SqlConnection(global::cwgl.Properties.Settings.Default.cwglCon);
private void button8_Click(object sender, EventArgs e)
{
string t1 = this.comboBox2.Text;
string t2 = this.textBox22.Text;
string t3 = this.textBox1.Text;
string t4 = this.textBox2.Text;
string t5 = this.textBox3.Text;
string t6 = this.textBox4.Text;
string t7 = this.textBox21.Text;
string t8 = this.textBox5.Text;
string t9 = this.textBox6.Text;
string t10 = this.textBox7.Text;
string t11 = this.textBox8.Text;
string t12 = this.textBox9.Text;
string t13 = this.textBox10.Text;
string t14 = this.textBox11.Text;
string t15 = this.textBox12.Text;
string t16 = this.textBox13.Text;
string t17 = this.textBox14.Text;
string t18 = this.textBox15.Text;
string t19 = this.textBox16.Text;
string t20 = this.textBox17.Text;
string t21 = this.textBox18.Text;
string t22 = this.textBox19.Text;
string t23 = this.textBox20.Text;
string t24 = this.label25.Text;
string t25 = this.comboBox1.Text;
if (l1 == "项目录入")
{
try
{
con.Open();
SqlCommand cmd = new SqlCommand(" select * from v_xmsz ", con);
SqlDataReader dr = cmd.ExecuteReader();
if (t3 == "")
{
MessageBox.Show("请输入具体的项目名称", "提示");
con.Close();
return;
}
while (dr.Read())
{
if (dr[2].ToString() == this.textBox1.Text)
{
MessageBox.Show("请勿输入相同的项目名称");
this.textBox1.Text = "";
con.Close();
return;
}
}
dr.Close();
if (t3 != "")
{
string sql = "insert into xmsz(zykf,kfs,fl,xm,mj,dj,jsjs,yjsjs,wjsjs,sjtc,kfxys,kfqss,kfqws,xmjk,jkzsr,hj,zdzc,cqzc,tdbp,tdcr,cbzc,qtzc,zhj,jy,dt) values('"
+ t1 + "','" + t2 + "','" + t25 + "','" + t3 + "','" + t4 + "','" + t5 + "','" + t6 + "','" + t7 + "','" + t8 + "','" + t9 + "','" + t10 + "','"
+ t11 + "','" + t12 + "','" + t13 + "','" + t14 + "','" + t15 + "','" + t16 + "','" + t17 + "','" + t18 + "','" + t19 + "','"
+ t20 + "','" + t21 + "','" + t22 + "','" + t23 + "','" + t24 +"')";
SqlCommand com = new SqlCommand(sql, con);
com.BeginExecuteNonQuery();
MessageBox.Show("添加成功!", "完成");
}
con.Close();
this.Close();
sykf sy = new sykf();
sy.ShowDialog();
}
catch (SqlException e1)
{
MessageBox.Show(e1.Message, "失败");
return;
}
}
}
private void button9_Click(object sender, EventArgs e)
{
this.Close();
}
private void textBox10_TextChanged(object sender, EventArgs e)
{
try
{
if (float.Parse(textBox10.Text.ToString().Trim()) >= 0)
{
float t1 = float.Parse(textBox10.Text.ToString().Trim());
}
else
{
MessageBox.Show("请输入正整数", "提示");
this.textBox10.Text = "0";
}
}
catch (FormatException e1)
{
MessageBox.Show(e1.Message,"请输入数字");
this.textBox10.Text = "0";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -