We help IT Professionals succeed at work.
Get Started

Datagrid won't display results

vbasqlprogrammer
on
303 Views
Last Modified: 2012-05-11
Hi,

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,

Tim
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
        gvfiles.DataBind()

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

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE