Pagina 1 di 1

[VB6] pulsanti di msgbox

MessaggioInviato: ven lug 23, 2004 9:45 am
da enrico83
Buongiorno! ho un problema, non riesco a trovare il modo di reagire in diversa maniera in seguito alla pressione di un tasto si o no di 1 msgbox. se x esempio ho:

msgbox"Continuare?" , VbInformation + VbYesNo, "Richiesta"

come faccio a catturare l'evento pressione del tasto da parte dell'utente per poi differenziare il codice a seconda della sua scelta??
Spero di essere stato chiaro...[cry] [V]

Grazie!!!

MessaggioInviato: ven lug 23, 2004 10:55 am
da Zane
devi utilizzare un if: fai così

Codice: Seleziona tutto
risposta=msgbox("Vuoi accoppiarti con un toro?", vbyesno+vbinfo, "Domanda")
if rispota=6 then
msgbox "L'utente ha premuto SI"
else
msgbox "L'utente ha premuto NO"
end if

MessaggioInviato: ven lug 23, 2004 1:42 pm
da enrico83
Ok, fatto come dici tu e funziona!!
Grande Zane, The best!!
ciao![dance]

MessaggioInviato: ven lug 23, 2004 5:53 pm
da M@ttia
L'esempio è riferito ad una qualche esperienza personale??? [:D]

MessaggioInviato: lun lug 26, 2004 8:44 am
da Robby78
soltanto x info, esistono le costanti vb x i parametri ed i valori di ritorno dalla msgbox:

<font color="red">Parametri: </font id="red">
vbOKOnly 0 OK button only (default)
vbOKCancel 1 OK and Cancel buttons
vbAbortRetryIgnore 2 Abort, Retry, and Ignore buttons
vbYesNoCancel 3 Yes, No, and Cancel buttons
vbYesNo 4 Yes and No buttons
vbRetryCancel 5 Retry and Cancel buttons
vbCritical 16 Critical message
vbQuestion 32 Warning query
vbExclamation 48 Warning message
vbInformation 64 Information message
vbDefaultButton1 0 First button is default (default)
vbDefaultButton2 256 Second button is default
vbDefaultButton3 512 Third button is default
vbDefaultButton4 768 Fourth button is default
vbApplicationModal 0 Application modal message box (default)
vbSystemModal 4096 System modal message box
vbMsgBoxHelpButton 16384 Adds Help button to the message box
VbMsgBoxSetForeground 65536 Specifies the message box window as the foreground window
vbMsgBoxRight 524288 Text is right aligned
vbMsgBoxRtlReading 1048576 Specifies text should appear as right-to-left reading on Hebrew and Arabic systems

<font color="red">Valori di ritorno:</font id="red">
vbOK 1 OK button pressed
vbCancel 2 Cancel button pressed
vbAbort 3 Abort button pressed
vbRetry 4 Retry button pressed
vbIgnore 5 Ignore button pressed
vbYes 6 Yes button pressed
vbNo 7 No button pressed

tratto dalla guida di VB6