How do I fix this: Me.dgvData.DataSource = dt, there are three date of birth dropdown list

Private Sub RefreshData()
        If Not cnn.State = ConnectionState.Open Then
            'open connection
            cnn.Open()
        End If

        Dim da As New OleDb.OleDbDataAdapter("SELECT txtstdid as [ID], " & _
                                             "txtstdname as [Name], cbosex as [Gender], chodob1 as [Date Of Birth], chodob2 as [Date Of Birth], chodob3 as [Date Of Birth], txtic as [Identification Number Card], txtpassn as [Passport Number], txtpn as [Phone Number], dod1 as [Date Of Departure], dod2 as [Date Of Departure], dod3 as [Date Of Departure], txtaddress as [Address], txtaapoa [Address At Point Of Arrival] " & _
                                             " FROM plane ORDER by txtstdid", cnn)

        Dim dt As New DataTable
        'fill data to datatable
        da.Fill(dt)

        'offer data in data table into datagridview
        Me.dgvData.DataSource = dt

        'close connection
        cnn.Close()
    End Sub

Recommended Answers

All 4 Replies

No0 need to mention Me.dgvData U can just say dgvData. And moreover what is the problem ur facing?

No0 need to mention Me.dgvData U can just say dgvData. And moreover what is the problem ur facing?

Hey, i just removed the Me. and the result is still the same. "dgvData" is not declared, and it maybe inaccessible due to its protection level. This is the only current problem I'm facing and searched for many helps in forum but couldn't get the answer :(
the link below is the one full version all my codes are inside please have a look thanks...
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/de721f35-c5a0-48cd-8214-b88aea01e292

TT.... no comments for me

In designer of the code check for Friend WithEvents dgvData as Datagridview. it should be there if not add. Or if its there then make it public
PUBLIC WithEvents dgvData as Datagridview

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.