Home All Groups Group Topic Archive Search About

What in the world is my prof trying to say? Dealing with MsgBox

Author
29 Sep 2006 2:36 AM
James
What does this mean?

'To specify more than the first argument, you must use the MsgBox
function in an expression'


I'd love to see an example. Thanks!

Author
29 Sep 2006 3:06 AM
GhostInAK
Hello James,

Sounds like your prof was smokin a lil too much wacky tobaccy that day.

-Boo

Show quoteHide quote
> What does this mean?
>
> 'To specify more than the first argument, you must use the MsgBox
> function in an expression'
>
> I'd love to see an example. Thanks!
>
Author
29 Sep 2006 11:33 PM
Dennis
The following specifies three arguments for a msgbox and it works fine as a
standalone statement:

MsgBox("Get a new Prof", MsgBoxStyle.Critical Or MsgBoxStyle.OKOnly, "Bad
Prof")
--
Dennis in Houston


Show quoteHide quote
"James" wrote:

> What does this mean?
>
> 'To specify more than the first argument, you must use the MsgBox
> function in an expression'
>
>
> I'd love to see an example. Thanks!
>
>
Author
20 Oct 2006 4:55 PM
Scott M.
First of all, if you are studying VB.NET, I would think your professor
should be teaching you about the MessageBox class, rather than the MsgBox
function.

Second, it sounds like he/she is saying that if you want to use more than
just the first argument of the MsgBox function (the prompt or message
itself), you'd need to be using the MsgBox function inside of another
expression.  That's not true though.  Although many of the additional
parameters of the MsgBox function lend themselves to getting a return value
(and thus, you may want to capture that return value by using this function
inside of another expression), you don't necessarially have to capture the
return value.  For example:

MsgBox "message", "something"

I think what he/she should have said was "When using MsgBox as a function
(where the arguments are specified inside of parenthesis), you are implying
that you want the return value of the function and so should use MsgBox()
inside of another expression, such as:

Dim i As Integer
i = MsgBox("Are you hungry", "Question", vbYesNo)




Show quoteHide quote
"James" <jamesburk***@gmail.com> wrote in message
news:1159497363.255462.100250@k70g2000cwa.googlegroups.com...
> What does this mean?
>
> 'To specify more than the first argument, you must use the MsgBox
> function in an expression'
>
>
> I'd love to see an example. Thanks!
>
Author
20 Oct 2006 5:59 PM
Al Reid
"Scott M." <NoSpam@NoSpam.com> wrote in message news:ec$zZiG9GHA.4860@TK2MSFTNGP03.phx.gbl...
> First of all, if you are studying VB.NET, I would think your professor
> should be teaching you about the MessageBox class, rather than the MsgBox
> function.
>

Since the MsgBox function is part of the Visual Basic Language, it is totally appropriate.

> Second, it sounds like he/she is saying that if you want to use more than
> just the first argument of the MsgBox function (the prompt or message
> itself), you'd need to be using the MsgBox function inside of another
> expression.  That's not true though.  Although many of the additional
> parameters of the MsgBox function lend themselves to getting a return value
> (and thus, you may want to capture that return value by using this function
> inside of another expression), you don't necessarially have to capture the
> return value.  For example:
>
> MsgBox "message", "something"
>

That won't work since the second argument is not a string.  So it would look something like:

MsgBox("message", MsgBoxStyle.OkCancel, "something")


> I think what he/she should have said was "When using MsgBox as a function
> (where the arguments are specified inside of parenthesis), you are implying
> that you want the return value of the function and so should use MsgBox()
> inside of another expression, such as:
>
> Dim i As Integer
> i = MsgBox("Are you hungry", "Question", vbYesNo)
>

i = MsgBox("Are you hungry", vbYesNo, "Question")

or
i = MsgBox("Are you hungry", MsgBoxStyle.YesNo, "Question")

>
>
>


--
Al Reid