Kamis, 16 Januari 2014

Menampilkan pesan sebelum form closing

Untuk membuat pesan konfirmasi sebelum menutup Form caranya sangat mudah. Anda tinggal menuliskan kode ini do event Form1_FormClosing :
If MsgBox("Anda yakin ingin keluar ?", MsgBoxStyle.Information Or MsgBoxStyle.YesNo, "Konfirmasi") = MsgBoxResult.Yes Then
  e.Cancel = False
Else
  e.Cancel = True
End If