Senin, 21 Mei 2018

MESSAGEBOX (MSGBOX)

Pertemuan ke 6


MESSAGEBOX (MSGBOX)


MsgBox (Kotak Pesan)

Berfungsi untuk menampilkan pesan atau komentar dalam bentuk form.


Bentuk Perintah
MsgBox(“Isi Pesan“, MsgBoxStyle, “Judul Pesan“)

 










Ada beberapa MsgBoxStyle, yaitu:


 
1.    MsgBoxStyle.Critical (16)                   :    tombol OK dan gambar icon Critical


  
2.     MsgBoxStyle.Question (32)               :    tombol OK dan gambar icon Question


  
3.     MsgBoxStyle.Exclamation (48)         :    tombol OK dan gambar icon Exclamation


  
4.     MsgBoxStyle.Information (64)           :    tombol OK dan gambar icon Information

5.    MsgBoxStyle.AbortRetryIgnore (2)   :    tombol Abort, Retry dan Ignore.
6.    MsgBoxStyle.OkCancel (1)                :    tombol OK dan Cancel.
7.    MsgBoxStyle.OkOnly (0)                    :    tombol OK.
8.    MsgBoxStyle. RetryCancel (5)          :    tombol Retry dan Cancel.
9.    MsgBoxStyle.YesNo (4)                      :    tombol Yes dan No.
10.  MsgBoxStyle. YesNoCancel (3)        :    tombol Yes, No dan Cancel.



Contoh 1:
Membuat Form Login dengan tampilan sbb:

 






Alur Program:
-    Input Password.
-    Klik Proses
-    Jika Password benar maka akan tampil kotak pesan (MessageBox) dengan tampilan sbb:
·    Isi pesan         :  Password yang Anda Masukkan Benar
·    Judul Pesan  :  Info Login
·    MsgBoxStyle  :  Tombol OK dengan gambar icon Information.
-    Jika Password salah maka akan tampil kotak pesan (MessageBox) dengan tampilan sbb:
·    Isi pesan         :  Password yang Anda Masukkan Salah”
·    Judul Pesan  : Info Login
·    MsgBoxStyle  :  Tombol OK dengan gambar icon Critical.


Kode Program:
Kode program diketik pada Objek BtnProses (Tombol Proses)  sbb:
Private Sub BtnProses_Click(ByVal sender As System.Object,...
    If TxtPas.Text = "rahasia" Then
        MsgBox("Password yang Anda Masukkan Benar",
               MsgBoxStyle.Information, "Info Login")
    Else
        MsgBox("Password yang Anda Masukkan Salah", 16,"Info")
    End If  
End Sub

Tidak ada komentar:

Posting Komentar

Koneksi Visual basic ke Database

Basis Data dan DBMS. Basis data (database) adalah kumpulan data yang disimpan secara sistematis di dalam komputer yang dapat diolah atau...