Click here to Skip to main content
16,020,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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;



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..
Posted

You have to add one line code after this

DT.Rows.Add(1, it, 2, 4);
DT.AcceptChanges();
 
Share this answer
 
Try to check if your datable has row values or else check the following links for adding datarow.

C#
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[^]
 
Share this answer
 
v2
Comments
praks_1 29-Jul-13 3:20am    
can u change ur cell type for Int64[] ???
Anjanee Kumar Singh 29-Jul-13 4:57am    
Thanks for ur valuable link you saved my lot of time....

Thank You..
Assuming you are C#, after this line:
C#
dataGridView1.DataSource = BSLive;


Write below line:
C#
dataGridView1.DataBind();
 
Share this answer
 
Comments
Anjanee Kumar Singh 29-Jul-13 2:27am    
i am working on win form

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900