将数据添加到datagridview [英] add data to datagridview
本文介绍了将数据添加到datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
hello
string firstColumn = txtproject.Text;
string secondColumn = txtcode.Text;
string[] row = { firstColumn, secondColumn };
dataGridView1.Rows.Add(row);
我插入此代码后添加按钮,它不会显示在数据网格视图中.....有人可以给我帮忙吗?
After I inserted this code for add button it won't show in data grid view ...... can some one give me help ?
推荐答案
int i = dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[0].Value = txtproject.Text;
dataGridView1.Rows[i].Cells[1].Value = txtcode.Text;
>
this code will working correctly...u should wrote that inside button click event...I have checked it..
这篇关于将数据添加到datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文