[RESOLVED] System Generate Error Message Specify Cast Is Not Valid
System Generate Error Message Specify Cast Is Not Valid
public int EditGrid(DataGrid myGrid, string myValue)
{
DataTable myTable= null;
myTable= (DataTable)myGrid.DataSource;
}
Re: System Generate Error Message Specify Cast Is Not Valid
You are trying to put a datasource into a table object => that's a big no no ;)
And by trying to convert the datasource to a table object ...., no that is not the way cause simply a datasource isn't a table object.
If I'm not mistaken it my work like this : myTabel = myDs.Tables[int index];
and myDs is the datasource of your datagrid
Re: System Generate Error Message Specify Cast Is Not Valid
but we can do this in vb.net
myTable = CType(myGrid.DataSource, DataTable)
Re: System Generate Error Message Specify Cast Is Not Valid
could be but this is C#.
Just get the datasource of your datagrid and then get the table from the datasource