Results 1 to 2 of 2

Thread: Deleting records (MDI forms)

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    4

    Deleting records (MDI forms)

    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?

    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
    So this will delete everything (even if there's still classes in the school).
    Can someone fix this?

    Thank you very much,
    Xler8tor

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    4

    Re: Deleting records (MDI forms)

    Has anyone already have a solution?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width