怎么向textbox中添加datagirdveiw选中一列的数据?
2个回答
展开全部
分为连接数据源和非数据源两种
非连接数据源
dataGridView1.ColumnCount = 3;
dataGridView1.Columns[0].HeaderText = "ID号";
dataGridView1.Columns[1].HeaderText = "时间";
dataGridView1.Columns[2].HeaderText = "心跳值";
DataGridViewRow row = new DataGridViewRow();
//row.Cells["ID号"].Value = "1";
;
row.CreateCells(dataGridView1);
row.Cells[0].Value = "1";
row.Cells[1].Value = "1";
row.Cells[2].Value = "60";
dataGirdView1.Rows.Insert(0,row);
dataGridView1.Rows.Add(row);
连接数据源
DataTable dt = new DataTable();
dt.Columns.Add("a");
dt.Columns.Add("b");
DataRow dr = dt.NewRow();
dr["a"] = "1";
dr["b"] = "2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dataGridView1.DataSource = dt;
非连接数据源
dataGridView1.ColumnCount = 3;
dataGridView1.Columns[0].HeaderText = "ID号";
dataGridView1.Columns[1].HeaderText = "时间";
dataGridView1.Columns[2].HeaderText = "心跳值";
DataGridViewRow row = new DataGridViewRow();
//row.Cells["ID号"].Value = "1";
;
row.CreateCells(dataGridView1);
row.Cells[0].Value = "1";
row.Cells[1].Value = "1";
row.Cells[2].Value = "60";
dataGirdView1.Rows.Insert(0,row);
dataGridView1.Rows.Add(row);
连接数据源
DataTable dt = new DataTable();
dt.Columns.Add("a");
dt.Columns.Add("b");
DataRow dr = dt.NewRow();
dr["a"] = "1";
dr["b"] = "2";
dt.Rows.Add(dr);
dr = dt.NewRow();
dataGridView1.DataSource = dt;
2016-01-16
展开全部
subunit-boundary {
fill: none;
stroke: #777;
stroke-dasharray: 2,2;
stroke-linejoin: round;
}
subunit-boundary.IRL {
stroke: #aaa;
}
fill: none;
stroke: #777;
stroke-dasharray: 2,2;
stroke-linejoin: round;
}
subunit-boundary.IRL {
stroke: #aaa;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询