datagrid视图未显示所有值 [英] datagrid view not showing all the values
本文介绍了datagrid视图未显示所有值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
BindingSource BSLive = new BindingSource();
DT = new DataTable();
DT.Columns.Add("Symbol");
DT.Columns.Add("Price", typeof(Int64[]));
DT.Columns.Add("Volume", typeof(Int64));
DT.Columns.Add("DateNTime", typeof(Int64));
Int64[] it = { 1, 2, 3, 4 };
DT.Rows.Add(1, it, 2, 4);
BSLive.DataSource = DT;
dataGridView1.DataSource = BSLive;
我试图在a中显示这些值datagridview ....
如果我错误地传递价值那么请建议我正确的方式..
谢谢..
I am Trying to show these value in a datagridview....
If i am wrongly passing value then pls suggest me the right way..
Thank you..
推荐答案
假设你是C#,在此行之后:
Assuming you are C#, after this line:
dataGridView1.DataSource = BSLive;
写下以下行:
Write below line:
dataGridView1.DataBind();
尝试检查您的数据是否有行值,或者检查以下链接以添加数据行。 />
Try to check if your datable has row values or else check the following links for adding datarow.
DT.Rows.Add(new Object[] {1, "Smith"});
MSDN Link
http://msdn.microsoft.com/en-us/library /z16c79x4.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-4 [ ^ ]
你必须在此之后添加一行代码
DT.Rows.Add(1,it,2,4);
DT.AcceptChanges();
You have to add one line code after this
DT.Rows.Add(1, it, 2, 4);
DT.AcceptChanges();
这篇关于datagrid视图未显示所有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文