|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What in the world is my prof trying to say? Dealing with MsgBoxWhat 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! 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! > 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") -- Show quoteHide quoteDennis in Houston "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! > > 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! > "Scott M." <NoSpam@NoSpam.com> wrote in message news:ec$zZiG9GHA.4860@TK2MSFTNGP03.phx.gbl... Since the MsgBox function is part of the Visual Basic Language, it is totally appropriate.> 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 That won't work since the second argument is not a string. So it would look something like:> 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" > MsgBox("message", MsgBoxStyle.OkCancel, "something") > I think what he/she should have said was "When using MsgBox as a function i = MsgBox("Are you hungry", vbYesNo, "Question")> (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) > or i = MsgBox("Are you hungry", MsgBoxStyle.YesNo, "Question") > > > -- Al Reid |
|||||||||||||||||||||||