Results 1 to 4 of 4

Thread: [RESOLVED] System Generate Error Message Specify Cast Is Not Valid

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    141

    Resolved [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;
    }
    Last edited by Waseemalisyed; May 23rd, 2005 at 11:58 PM.

  2. #2
    Member
    Join Date
    Mar 2005
    Posts
    43

    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    141

    Angry Re: System Generate Error Message Specify Cast Is Not Valid

    but we can do this in vb.net

    myTable = CType(myGrid.DataSource, DataTable)

  4. #4
    Member
    Join Date
    Mar 2005
    Posts
    43

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width