|
-
Oct 20th, 2000, 06:07 AM
#1
Thread Starter
Member
1) I've got a msgbox with 2 button, ok and cancel. I want the ok button to unload everything (i.e. itself and the main form) and the cancel button just to unload itself(msgbox) and go back into the mainform. My Code so far is: msgbox "hello",vbOKCancel...(then what?!) I hope you underdstood that! (Please can you give me an e.g line as I'm fairly new to VB6)
2) How do you change the names of the buttons on the msgbox? (Please can you give me an e.g line as I'm fairly new to VB6)
Thank you very much
moonfruit
-
Oct 20th, 2000, 06:32 AM
#2
Lively Member
well, if you call the MsgBox function with:
Code:
x = MsgBox ("Press a button", vbOkCancel, "Title")
with any types of buttons you like, you can then do:
Code:
Select Case x
Case vbOK 'OK was pressed
'Your code here
Case vbCancel 'Cancel was pressed
'Your code here
Case vbAbort 'Abort was pressed
'Your code here
Case vbRetry 'Retry was pressed
'Your code here
Case vbIgnore Ignore was pressed
'Your code here
Case vbYes 'Yes was pressed
'Your code here
Case vbNo 'No was pressed
'Your code here
End Select
hope that helps..
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Oct 20th, 2000, 07:34 AM
#3
Frenzied Member
I don't know how to change the name of the button, there must be a way,but for now u can do a form that look like a message box, then you would be able to do what ever you want with it.
-
Oct 23rd, 2000, 12:37 PM
#4
Frenzied Member
Message Box
Your code should look like this:
Private Sub Command1_Click() 'COMMAND BUTTON CLICK EVENT
If MsgBox("Hello", vbExclamation Or vbOKCancel, _
"Exit") = vbOK Then
Unload Me 'UNLOADS THE FORM
End If
End Sub
If the cancel button is pressed, nothing will happen.
The "vbExclamation" tells it to show the yellow exclamation point icon and "vbOKCancel" gives you the OK and Cancel buttons. You must use "Or" between these. "And" makes more sense, but will not work.
You can use "vbCritical Or vbOKCancel". This shows the red X icon and OK and Cancel Buttons. There are several Icon and button choices. Just play around with it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|