Greetings can someone give me tips on how to solve this? When i'm searching for a data on the datagrid to edit it doesn't display the data to the corresponding text boxes. The textboxes is bound on the datafields I have these fields

Combobox - Searchbox
textfields
Student ID
Student Section
student name
etc
datagrid
buttons
Edit
Add
Search
Delete
Cancel
Save

this is the search code

btnName = "Search"

'=============================[THIS CODE UPDATES THE SELECTED DATA]========================='
    Dim conn As New ADODB.Connection
    Dim strConn As String
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GradingSystem.mdb;Persist Security Info=False"
    Set rs = New ADODB.Recordset
        rs.CursorLocation = adUseClient
        conn.Open strConn
        rs.Open "SELECT * FROM student_tbl where student_section = '" & cmbBoxSection.Text & "'", conn, adOpenDynamic, adUseClient
        Set DataGrid1.DataSource = rs
        DataGrid1.AllowAddNew = False
        DataGrid1.AllowArrows = True
        DataGrid1.AllowDelete = False
        DataGrid1.AllowUpdate = True
    '============[REBIND THE DATAFIELDS]============'
        txtStudentId.DataField = "student_Id"
        txtStudentFirstName.DataField = "student_firstName"
        txtStudentLastName.DataField = "student_lastName"
        txtStudentMi.DataField = "student_middleInitial"
        txtStudentSection.DataField = "student_section"
        txtQuiz1.DataField = "student_MidTermquiz1"
        txtQuiz2.DataField = "student_MidTermquiz2"
        txtQuiz3.DataField = "student_MidTermquiz3"
        txtQuiz4.DataField = "student_FinalTermquiz1"
        txtQuiz5.DataField = "student_FinalTermquiz2"
        txtQuiz6.DataField = "student_FinalTermquiz3"
        txtProject1.DataField = "student_MidTermproject"
        txtProject2.DataField = "student_FinalTermProject"
        txtAttendance1.DataField = "student_MidTermattendance"
        txtAttendance2.DataField = "student_FinalTermAttendance"
        txtParticipation1.DataField = "student_MidTermclassParticipation"
        txtParticipation2.DataField = "student_FinalTermClassParticipation"
        txtExam1.DataField = "student_MidTermexam"
        txtExam2.DataField = "student_FinalTermexam"
        txtMidTerm.DataField = "student_midTerm"
        txtFinalTerm.DataField = "student_finalTerm"
        txtAverage.DataField = "student_average"
        txtRemarks.DataField = "student_remarks"
'============[DISABLES AND ENABLES THE BUTTONS AFTER SEARCHING]============'
    cmdAdd.Enabled = False
    cmdCancel.Enabled = True
    cmdSave.Enabled = False
    cmdSearch.Enabled = True

Confused here. I can't understand what you want exactly.
You can't edit data in datagrid or you can't show data to the textboxes?

Sorry. I can't show the data to the textboxes.

Guys i really need help on this problem :/.

Change :

txtStudentId.DataField = "student_Id"
txtStudentFirstName.DataField = "student_firstName"
....

To :

txtStudentId.DataField = rs!student_Id
txtStudentFirstName.DataField = rs!student_firstName
....

Or :

txtStudentId.DataField = rs.Fields("student_Id").Value
txtStudentFirstName.DataField = rs.Fields("student_firstName").Value
....

Still not working :/

Still not working :/

Sorry..my bad. Wrong in my sample code.

Change :

txtStudentId.DataField = "student_Id"
txtStudentFirstName.DataField = "student_firstName"
....

To :

txtStudentId.Text = rs!student_Id
txtStudentFirstName.Text = rs!student_firstName
....

Or :

txtStudentId.Text = rs.Fields("student_Id").Value
txtStudentFirstName.Text = rs.Fields("student_firstName").Value
....
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.