Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wrote this code
BindingSource bs = (BindingSource )dgrid.DataSource;//Se convierte el DataSource
DataTable tCxC = (DataTable ) bs.DataSource;

But giving BindingSource(Assembly References )
Posted
Comments
Nandakishore G N 13-Feb-13 2:17am    
how did you bind to the grid?

Hi,
Try this-
VB
Dim dt As New DataTable()
dt = TryCast(dataGridView1.DataSource, DataTable)
 
Share this answer
 
Please try the below code snippet.....
C#
BindingSource bsTemp = (BindingSource)MyGrid.DataSource;
DataTable dt = (DataTable) bsTemp.DataSource;
 
Share this answer
 
v2
Hi,
Try this-
VB-
VB
Dim dt As New DataTable()
dt = TryCast(dataGridView1.DataSource, DataTable)

C#
C#
DataTable dt = new DataTable();
dt = dataGridView1.DataSource as DataTable;
 
Share this answer
 

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