DatagridView刷新问题 [英] DatagridView refresh problem

查看:82
本文介绍了DatagridView刷新问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我无法刷新我的datagridveiw控件

I have a problem that i can''t refresh my datagridveiw control

private void button1_Click(object sender, EventArgs e)
        {

            List<Customer> CustList = new List<Customer>();
            CustList.Add(new Customer() { Cust_id = int.Parse(textBox1.Text), Interarrival = int.Parse(textBox2.Text), ServiceTime = int.Parse(textBox3.Text) });
            dataGridView2.DataSource = CustList;

            dataGridView2.Refresh();
        }



第一次我单击button1 datagridview充满数据
第二次没有发生
谢谢



for the first time i clicked button1 datagridview filled with data
for the second time nothing occurred
thanks

推荐答案

最后,您应该添加gridview的数据绑定,然后自动刷新.
finally you should add the databind of gridview,then automatically refreshed.
dataGridView2.DataBind();


这篇关于DatagridView刷新问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆