![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2005
Posts: 60
Rep Power: 4
![]() |
MsgBox() Function Question
I just wondered how you tell the program what to do if user clicks Cancel, Abort, Retry or Okay is response to a sudden MsgBox.
Thanks in advance. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
It's pretty easy:
Dim Response As Integer
Response = MsgBox ("Blah", vbOKCancel, "Moomin")
If Response = vbOK Then
MsgBox "Alrighty then."
Else If Response = vbCancel Then
MsgBox "Funkadelic."
End If |
|
|
|
|
|
#3 |
|
Programmer
Join Date: May 2005
Posts: 60
Rep Power: 4
![]() |
Yeah, I know about the other controls. Thanks a lot Ooble!
Oh, and one other thing I was having problems with was pressing command to take me to another form. Hypothetically say I wanted vbOK to take them to the next screen (form3 lets say) or VBCancel to go back to the original form where they can say ... fill out an application form for something again (form 1 lets say). How would I do that? I've tried experimenting with GOTO form3 and GOTO (form3) and everything else I've come accross in program that I thought could work, but it hasn't worked with VB. The book I'm learning from is quite bad and I expect the answer to this question would probably be somewhere in chapter 19 when I'm in Chapter 8 now, and left in the dark. Again, help is appreaciated. Last edited by Clotters; Jun 10th, 2005 at 7:44 PM. Reason: Spelling |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
It depends on whether the form already exists or not. If you haven't yet loaded it, use Load Form2, otherwise use Form2.Show. It's the same when hiding it - if you want to just hide the form, use Form2.Hide, but if you want to completely remove the form from memory, use Unload Form2.
|
|
|
|
|
|
#5 |
|
Expert Programmer
|
Also,
Form1.SetFocus If you're making a "wizard" type application, I would suggest using one form with an array of borderless picture boxes holding the different objects shown in the main area, and making those visible/hidden appropriately, rather than using multiple forms. Makes pogramming the next back and cancel buttons easier, and reduces the likelihood of bugs . |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Jan 2005
Posts: 22
Rep Power: 0
![]() |
it may also help if you make a module with all ur code in it for the various forms of your program. i will find the code that i have and post it at a later date.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|