Hello all,
I'm making an application and I need some help. My application has three child forms (school - class - students). So in every school there are classes and in every class there are students. I want to delete this items but only if there are no items in the main item. So if I want to delete a school my class and my students needs to be empty (or zero).
Can someone help me with this delete - code?
So this will delete everything (even if there's still classes in the school).Code:Private Sub mnuSchoolsDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSchoolsDeleteItem.Click Dim DeleteName As String = school.Name_WN Try If MessageBox.Show("Are you sure " & school.Name_WN & " wilt delete?", "delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) = MsgBoxResult.Yes Then schools.Delete(school) MessageBox.Show(DeleteName & " is deleted") Else MessageBox.Show(school.Name_WN & " isn't deleted") End If Catch MessageBox.Show(Err.Description, Err.Source) End Try End Sub
Can someone fix this?
Thank you very much,
Xler8tor


Reply With Quote
