Perdon no habia leido bien, ahora que me fijo mejor esto va en .NET, de todos modos aqui tienes tu respuesta
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If saved = True Then
End
Else
If MsgBox(" Seguro que quiere salir sin guardar?", 1) = 1 Then
End
Else
e.Cancel = True
End If
End If
End Sub