Results 1 to 3 of 3

Thread: [RESOLVED]Getting Column Names, Col and row count from datagrid

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    425

    Resolved [RESOLVED]Getting Column Names, Col and row count from datagrid

    Hi,

    I am trying to get the column names and col/row count from a datagrid but it seems that i am stucked. I have tried the following which i got from searching the forum but i got an error : An unhandled exception of type 'System.InvalidCastException' occurred in WindowsApplication1.exe
    Additional information: Specified cast is not valid.


    VB Code:
    1. 'Dg is a datagrid
    2.  
    3.         Dim dt As DataTable
    4.         dt = Dg.DataSource
    5.         MsgBox(dt.Rows.Count.ToString)
    6.         MsgBox(dt.Columns.Count.ToString)

    thanks for your time
    Last edited by hyper88; Mar 21st, 2006 at 02:47 AM.

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