MsgBox Statement

Rodomas dialogo langas, kuriame yra pranešimas.

Sintaksė:


   MsgBox prompt As String [,buttons = MB_OK [,title As String]]
   response = MsgBox( prompt As String [,buttons = MB_OK [,title As String]])

Parametrai:

prompt: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).

title: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.

buttons: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. buttons represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:

Įvardinta konstanta

Sveikoji reikšmė

Aprašas

MB_OK

0

Rodyti tik mygtuką „Gerai“.

MB_OKCANCEL

1

Rodyti tik mygtukus „Gerai“ ir „Atsisakyti“.

MB_ABORTRETRYIGNORE

2

Rodyti „Nutraukti“, „Bandyti vėl“ ir „Nepaisyti“ mygtukus.

MB_YESNOCANCEL

3

Rodyti mygtukus „Taip“, „Ne“ ir „Atsisakyti“.

MB_YESNO

4

Rodyti „Taip“ ir „Ne“ mygtukus .

MB_RETRYCANCEL

5

Rodyti „Bandyti vėl“ ir „Atsisakyti“ mygtukus.

MB_ICONSTOP

16

Pridėti stabdymo piktogramą dialogo lange.

MB_ICONQUESTION

32

Pridėti klausimų piktogramą dialogo lange.

MB_ICONEXCLAMATION

48

Į dialogo langą įtraukite šauktuko piktogramą.

MB_ICONINFORMATION

64

Į dialogo langą įtraukite informacijos piktogramą.

128

Pirmasis mygtukas dialogo lange yra numatytasis.

MB_DEFBUTTON2

256

Antrasis mygtukas dialogo lange yra numatytasis.

MB_DEFBUTTON3

512

Trečiasis mygtukas dialogo lange yra numatytasis.


Klaidos kodai:

5 Neteisingas procedūros iškvietimas

Pavyzdys:


Sub ExampleMsgBox
 Const sText1 = "Įvyko netikėta klaida."
 Const sText2 = "Bet programos vykdymas bus toliau tęsiamas."
 Const sText3 = "Klaida"
 MsgBox(sText1 + Chr(13) + sText2,16,sText3)
 MsgBox(sText1 + Chr(13) + sText2, MB_ICONSTOP, sText3)
End Sub

Paremkite mus!