Showing message boxes

CoMp1eX

New member
Joined
Mar 15, 2007
Messages
2
Programming Experience
Beginner
Hi, i'm just finishing up my first VB class and really need help on a extra credit assignment.

Topic: To create an Project where you have about 10 popups that say "smarta$$" comments. Once one pops up with the OK messagebox that would say exam.- "HAHA click again!", then you click ok and another message pops up saying a diffent comment exam.- "Almost there!". I need about 10 messageboxes to pop up and exit in a row... Can someone please help me with the outline of this assignment?! THANK YOU SO MUCH IN ADVANCE!
 
You can just create several entries using the MsgBox function such as:

MsgBox("Click Me")

Or you can Use:

If Msgbox("Do you want to click me",....) =

Fill in the rest, it's easy. We can't do your assignments for you, this will get you going in the right direction. Review "MsgBox" in the documentation.
 
You can just create several entries using the MsgBox function such as:

MsgBox("Click Me")

Or you can Use:

If Msgbox("Do you want to click me",....) =

Fill in the rest, it's easy. We can't do your assignments for you, this will get you going in the right direction. Review "MsgBox" in the documentation.

Neal, you need to be slapped, it's Messagebox.Show, not Msgbox

alright? *sighs* ;)
 
Yea, I know I just need some help. Thanks!

Is there any way to position a MessageBox on the screen? So when the person pushes ok another MessageBox pops up at a different location?
 
*shakes head* I dunnae think sew me laddy. I've never seen message boxes in other locations unless they were home made dialogs/forms. You could always extend MessageBox but I guess you haven't quite reached that point yet.

Bear in mind that the general purpose of a message box is to alert the user about something, warn them, etc. and, of course, the best place to do this is the middle of the screen. Also, use MessageBox.Show since it is the .NET message box and works in C# and VB unlike MsgBox which is VB only (as far as I know).

To answer your original question and elaborate on what Neal said: message boxes (MsgBox and MessageBox) return a dialog result which lets you know which button on the message box was clicked. So if you wanted to run code based on a certain result you would do something like this:

VB.NET:
If MessageBox.Show("Example", "Example", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
     'Do this.
Else
     'Do something else.
End If
But if all you wanna do is display message boxes one after another just go:
VB.NET:
MessageBox.Show(...)
MessageBox.Show(...)
.
.
.
They will display one after another since message boxes are modal(you'll understand when you get there) and any code which comes after them only executes once the message box closes.

*nods*
 
Back
Top