i search record from the present form then i want to load it in another form
for editing and saving the record. here's my code but its always error.

With list_stud
    .label1.caption = ID_no
    .label2.caption = lvStudentInfo.SelectedItem.SubItems(1)
    .label3.caption = lvStudentInfo.SelectedItem.SubItems(2)
    .label4.caption = lvStudentInfo.SelectedItem.SubItems(3)
    .label5.caption = lvStudentInfo.SelectedItem.SubItems(4)
    .label6.caption = lvStudentInfo.SelectedItem.SubItems(5)
    .Show 1
End With

please help me with this.

Recommended Answers

All 5 Replies

what error are you getting, and on what line?

the problem is nothing will display. is there something wrong with my code?

I'm assuming lvStudentInfo is the listview on the other form. You have to identify it by the form it's on MyOtherForm.lvStudentInfo

Add the following to your code...

With frmYourSecondFormNameHere
    With list_stud
        .label1.caption = ID_no
        .label2.caption = lvStudentInfo.SelectedItem.SubItems(1)
        .label3.caption = lvStudentInfo.SelectedItem.SubItems(2)
        .label4.caption = lvStudentInfo.SelectedItem.SubItems(3)
        .label5.caption = lvStudentInfo.SelectedItem.SubItems(4)
        .label6.caption = lvStudentInfo.SelectedItem.SubItems(5)

        .Show 1
    End With
End With

I think you need a '.' in front of each lvStudentInfo.

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.