Private Sub btnedit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnedit.Click
        'check for the selected item in list
        If Me.dgvData.Rows.Count > 0 Then
            If Me.dgvData.SelectedRows.Count > 0 Then
                Dim intStdID As Integer = Me.dgvData.SelectedRows(0).Cells("id").Value
                'get data from database followed by id
                'open connection
                If Not cnn.State = ConnectionState.Open Then
                End If
                'Get data into database
                Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Plane " & _
                                                     " WHERE txtstdid=" & inttxtstdid, cnn)
                Dim dt As New DataTable

                Me.txtstdid.Text = instdID
                Me.txtstdname.Text = dt.Rows(0).Item("stdname")
                Me.Combobox2.Text = dt.Rows(0).Item("Gender")
                Me.cbodob1.Text = dt.Rows(0).Item("DOB1")
                Me.chodob2.Text = dt.Rows(0).Item("DOB2")
                Me.chodob3.text = dt.Rows(0).Item("DOB3")
                Me.txtic.Text = dt.Rows(0).Item("IC Number")
                Me.txtpassn.Text = dt.Rows(0).Item("Passport Number")
                Me.txtpn.Text = dt.Rows(0).Item("Phone Number")
                Me.dod1.Text = dt.Rows(0).Item("DOP1")
                Me.dod2.Text = dt.Rows(0).Item("DOP2")
                Me.dod3.Text = dt.Rows(0).Item("DOD3")
                Me.txtaapoa.Text = dt.Rows(0).Item("AAPOA")
                'hide the id to be edited in TAG of txtstdid in case id is changed
                Me.txtstdid.Tag = instdID
                'change button add to update
                Me.btnadd.Text = "Update"
                'disable button edit
                Me.btnedit.Enabled = False
            End If
        End If
    End Sub

please help I got no idea how to solve these problems please help..

Errors: "inttxtstdid' is not declared. It may be inaccessible due to its protection level"

'instdID' is not declared. It may be inaccessible due to its protection level.'
'chodob2' is not a member of 'AirplaneAirplane'
'chodob3' is not a member of 'AirplaneAirplane'

Me.txtaddress.text(dt.rows(0).Items("address") property value

Recommended Answers

All 2 Replies

Try declaring

Dim instdID As Integer

and then assign value to it.
where you declared "inttxtstdid" ??

'AirplaneAirplane' is class? and 'chodob2' and 'chodob3' are member of class? and declared as public? Check ur desiner code.

Be a part of the DaniWeb community

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