MsgBox funkcija

Parodo dialogo langą su pranešimu ir grąžina reikšmę.

Sintaksė:


MsgBox (Prompt As String [,Buttons = MB_OK [,Title As String]]) As Integer

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.


Grąžinimo reikšmė:

Sveikasis skaičius

Įvardinta konstanta

Sveikoji reikšmė

Aprašas

IDOK

1

Gerai

IDCANCEL

2

Atsisakyti

IDABORT

3

Nutraukti

IDRETRY

4

Bandyti dar kartą

IDIGNORE

5

Nepaisyti

IDYES

6

Taip

IDNO

7

Ne


Klaidos kodai:

5 Neteisingas procedūros iškvietimas

Pavyzdys:


Sub ExampleMsgBox
Dim sVar As Integer
 sVar = MsgBox("Las Vegas")
 sVar = MsgBox("Las Vegas", 1)
 sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Dialogo antraštė")
 sVar = MsgBox("Las Vegas", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Dialog title")
End Sub

Paremkite mus!