VBScript MsgBox function

Pagsasaayos at Paggamit

Ang MsgBox function ay maaaring ipakita ang isang message box, naghihintay sa pag-click ng user ng anumang button, at pagkatapos ay ibalik ang halaga ng pinindot na button.

Ang MsgBox function ay maaaring ibalik ang mga sumusunod na halaga:

  • 1 = vbOK - Ang kanyang button ay pinindot para matiyak.
  • 2 = vbCancel - Ang kanyang button ay pinindot para kanselahin.
  • 3 = vbAbort - Ang kanyang button ay pinindot para itigil.
  • 4 = vbRetry - Ang button ng muling subukan ay pinindot.
  • 5 = vbIgnore - Ang button ng ignoro ay pinindot.
  • 6 = vbYes - Ang button ng oo ay pinindot.
  • 7 = vbNo - Ang button ng hindi ay pinindot.

Komentaryo:Kung ang helpfile at context na mga parameter ay naipapagbigay, ang gumagamit ay maaaring mag-click ng F1 key upang tingnan ang tulong.

Paalaala:Mangyaring tingnan ang function ng InputBox.

Pagsusukat

MsgBox(prompt[,buttons][,title][,helpfile,context])
Parametro Paglalarawan
prompt Mahalagang itong ipaalam. Ang string expression na ipakita sa dialog box na mensahe. Ang pinakamataas na haba ng prompt ay humigit-kumulang 1024 na character, depende sa lapad ng character na ginamit. Kung may ilang mga linya ang prompt, maaaring paghiwalay ang bawat linya gamit ang carriage return (Chr(13)), line feed (Chr(10)) o kombinasyon ng parehong (Chr(13) & Chr(10)).
buttons

Ang eksprasyon ng numero, ay naglalarawan ng bilang ng number at uri ng naipakita na button, uri ng icon, tanda ng pangunahing button at uri ng mensaheng box ng mensahe. Kung binigong ipaalam, ang default na halaga ng buttons ay 0.

Ang halaga ng button:

  • 0 = vbOKOnly - Ipakita lamang ang button ng ok.
  • 1 = vbOKCancel - Ipakita ang button ng ok at kanselahin.
  • 2 = vbAbortRetryIgnore - Ipakita ang button ng alisin, muling subukan at ignoro.
  • 3 = vbYesNoCancel - Ipakita ang button ng oo, hindi at kanselahin.
  • 4 = vbYesNo - Ipakita ang button ng oo at hindi.
  • 5 = vbRetryCancel - Ipakita ang button ng muling subukan at kanselahin.
  • 16 = vbCritical - Ipakita ang icon ng kritikal na mensahe.
  • 32 = vbQuestion - Ipakita ang icon ng pagtatanong ng babala.
  • 48 = vbExclamation - Ipakita ang icon ng mensahe ng babala.
  • 64 = vbInformation - Ipakita ang icon ng mensahe ng impormasyon.
  • 0 = vbDefaultButton1 - Ang unang button ay pangunahing button.
  • 256 = vbDefaultButton2 - Ang ikalawang button ay pangunahing button.
  • 512 = vbDefaultButton3 - Ang ikatlong button ay pangunahing button.
  • 768 = vbDefaultButton4 - Ang ikaapat na button ay pangunahing button.
  • 0 = vbApplicationModal - Ang aplikasyon mode: Ang gumagamit ay dapat tumugon sa message box upang magpatuloy sa paggamit ng kasalukuyang aplikasyon.
  • 4096 = vbSystemModal - System Mode: All applications are suspended until the user responds to the message box.

The first group of values (0 - 5) is used to describe the type and number of buttons displayed in the dialog box; the second group of values (16, 32, 48, 64) is used to describe the style of the icon; the third group of values (0, 256, 512) determines the default button; and the fourth group of values (0, 4096) determines the style of the message box. When adding these numbers to generate the buttons parameter value, only one number can be taken from each group.

title String expression displayed in the dialog box title bar. If title is omitted, the name of the application is displayed in the title bar.
helpfile String expression, used to identify the help file that provides context-related help for the dialog box. If helpfile is provided, context must be provided. Not available on 16-bit system platforms.
context Numeral expression, used to identify the context number assigned by the author of the help file to a specific help topic. If context is provided, helpfile must be provided. Not available on 16-bit system platforms.

Halimbawa

dim answer
answer=MsgBox("Hello everyone!",65,"Example")
document.write(answer)