📄 修改型号.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 计量
{
public partial class 修改型号 : Form
{
string a = "", b = "", c = "", d = "";
public 修改型号()
{
InitializeComponent();
}
private void 修改型号_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“sqldatabase_DataDataSet.型号表”中。您可以根据需要移动或移除它。
this.型号表TableAdapter.Fill(this.sqldatabase_DataDataSet.型号表);
this.textBox1.ReadOnly = true;
this.textBox2.ReadOnly = true;
this.textBox3.ReadOnly = true;
this.textBox4.ReadOnly = true;
this.button2.Enabled = false;
this.button3.Enabled = false;
}
private void button1_Click(object sender, EventArgs e)
{
this.dataGridView1.Enabled = false;
this.comboBox1.Enabled = false;
this.textBox1.ReadOnly = false;
this.textBox2.ReadOnly = false;
this.textBox3.ReadOnly = false;
this.textBox4.ReadOnly = false;
this.button1.Enabled = false;
this.button2.Enabled = true;
this.button3.Enabled = true;
a = this.textBox1.Text.Trim();
b = this.textBox2.Text.Trim();
c = this.textBox3.Text.Trim();
d = this.textBox4.Text.Trim();
}
private void button2_Click(object sender, EventArgs e)
{
try
{
MessageBox.Show(this.comboBox1.Text.Trim());
int ii = this.型号表TableAdapter.Update(this.comboBox1.Text.Trim(),this.textBox1.Text.Trim(),this.textBox2.Text.Trim(),this.textBox3.Text.Trim(),this.textBox4.Text.Trim(),this.comboBox1.Text.Trim(),a,b,c,d);
if (ii == 0) MessageBox.Show("修改失败");
else MessageBox.Show("修改成功");
}
catch (Exception exc)
{
MessageBox.Show("修改失败"+exc.Message);
}
this.textBox1.ReadOnly = true;
this.textBox2.ReadOnly = true;
this.textBox3.ReadOnly = true;
this.textBox4.ReadOnly = true;
this.button1.Enabled = true;
this.button2.Enabled = false;
this.button3.Enabled = false;
this.dataGridView1.Enabled = true;
this.comboBox1.Enabled = true;
this.型号表TableAdapter.Fill(this.sqldatabase_DataDataSet.型号表);
}
private void button3_Click(object sender, EventArgs e)
{
this.textBox1.ReadOnly = true;
this.textBox2.ReadOnly = true;
this.textBox3.ReadOnly = true;
this.textBox4.ReadOnly = true;
this.button1.Enabled = true;
this.button2.Enabled = false;
this.button3.Enabled = false;
this.dataGridView1.Enabled = true;
this.comboBox1.Enabled = true;
this.型号表TableAdapter.Fill(this.sqldatabase_DataDataSet.型号表);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -