Saturday, July 25, 2009

Perintah MsgBox dan InputBox pada VB

MsgBox membuat jendela dialog dengan dengan pesan agar pengguna memberikan tanggapan dengan mengklik salah satu tombol yang ada.
Format penulisan : MsgBox(prompt[, Kode_Tombol]][, title][, helpfile, context])
Kode Tombol Bilangan Tampilan pada Jendela Dialog

VbOKOnly 0 Tombol OK saja
VbOKCancel 1 Tombol OK dan Cancel
VbAbortRetryIgnore 2 Tombol Abort, Retry dan Ignore
VbYesNoCancel 3 Tombol Yes, No dan Cancel
VbYesNo 4 Tombol Yes dan No
VbRetryCancel 5 Tombol Retry dan Cancel
VbCritical 16 Icon pesan kritis
VbQuestion 32 Icon ?
VbExclamation 48 Icon !
VbInformation 64 Icon pesan informasi
VbDefaultButton1 0 Tombol pertama sbg default
VbDefaultButton2 256 Tombol kedua sbg default
VbDefaultButton3 512 Tombol ketiga sbg default
VbDefaultButton4 768 Tombol keempat sbg default
VbMsgBoxHelpButton 16384 Menampilkan juga tombol "Help"


i = msgbox (“Read this !”, vbOKOnly, “Test Message”)
InputBox membuat jendela dialog input data yang meminta untuk memasukkan data string.
Format penulisan : InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context])
Dim Message, Title, Default, MyValue
Message = “Enter a value between 1 and 3”
Title = “InputBoxDemo” ‘set title
MyValue = InputBox(Message, Title, Default)

‘ Helpfile and context, add Help button automatically
MyValue = InputBox(message, Title, , , , ”DEMO.HLP”, 10)

‘ Display dialog box at posotion 100,100
MyValue = InputBox(Message, Title, Default, 100, 100)



0 comments:

Post a Comment