为了方便理解业务功能,先从简单UI控件抽象开始; 否则后面的根本走不动,不但走不动,并且会非常的打击开发写代码的积极性,也是非常现实的事情。因为本身业务进度,都是非常赶的!如果跟不上公司进度,那么您的饭碗就不保了。
效果
dataGridView1控件拖动就行
此按钮代码
private void dataGridViewbutton1_Click(object sender, EventArgs e)
{// hello world
// a-1 类 字段 属性的方法赋值;
int index = this.dataGridView1.Rows.Add();this.dataGridView1.Rows[index].Cells[0].Value = "1";// 第一列数据
this.dataGridView1.Rows[index].Cells[1].Value = "2";// 第2列数据
this.dataGridView1.Rows[index].Cells[2].Value = "3";// 第3列数据
this.dataGridView1.Rows[index].Cells[3].Value = "hello world ";// 第4列数据内容添加,and成功展示
this.dataGridView1.Rows[index].Cells[4].Value = "hello world4 ";}
第二个按钮代码
private void button1_Click(object sender, EventArgs e)
{
// a-1 类 字段 属性的方法赋值; 内置的用属性获取一个集合,里面的数据
int variables = this.dataGridView1.Rows.Add();this.dataGridView2.Rows[variables].Cells[0].Value = "数据";// 第一列数据; 这是直接赋值方式,业务中绕弯子,多加扩展变量了。
this.dataGridView2.Rows[variables].Cells[1].Value = "Test item";// 第2列数据
this.dataGridView2.Rows[variables].Cells[2].Value = "测试项目";// 第3列数据
this.dataGridView2.Rows[variables].Cells[3].Value = "数据库读取数据测试 ";// 第4列数据}
(红孩儿技术交流群)QQ群: 792710015
微信:madaochenggong2033