troubleshooting Question

Datagrid won't display results

Avatar of vbasqlprogrammer
vbasqlprogrammer asked on
5 Comments1 Solution306 ViewsLast Modified:

I have a datagrid which is populated after i run a function which returns a datatable.  However the gridview will not display the results.  I have attached the code.  Can any body lend us a hand?  

I have test the datatable to see if there is data in it by using msgbox to display data from the various rows so I know there is data there.

I have posted the code for your perousal.

Kind Regards,

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim Token As String = Me.resultlabel.Text
        Dim gvfiles As New GridView
        Dim mydatatable As New Data.DataTable

        mydatatable = returnitems(Token, "\CHRISTADSTUDIES\Studies") 'this functions returns a datatable
        Dim row1 As Data.DataRow = mydatatable.Rows(2)
        MsgBox(row1(0).ToString) 'test to make sure data is in the table
        gvfiles.AutoGenerateColumns = True
        gvfiles.DataSource() = mydatatable

        errorlabel.Text = "completed" 'A label I used to make sure the code ran thru to the end.
    End Sub

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros