|
-
July 13th, 2001, 03:24 PM
#1
MsgBox Problem
I can get a message box to pop up using the MsgBox Function, but if I try to add any other parameters besides the prompt, I get this:
Compile error:
Expected: =
All I wanted was to specify the title. Here is the code I wrote:
MsgBox("There is an error.", ,"WARNING")
Can someone tell me what I'm doing wrong? Thanks.
The more you know, the more you know you don't know.
The more you know, the more you know you don't know.
-
July 13th, 2001, 03:33 PM
#2
Re: MsgBox Problem
Try it like this...
MsgBox "Message", , "Message Title"
-
July 13th, 2001, 03:38 PM
#3
Re: MsgBox Problem
That worked perfectly, thanks! I guess it was those brackets hanging me up.
The more you know, the more you know you don't know.
The more you know, the more you know you don't know.
-
July 13th, 2001, 04:09 PM
#4
Re: MsgBox Problem
If you do want to use brackets, try this:
Call MsgBox("There is an error.", ,"WARNING")
This is because you use Option Explicit.
Regards,
Michi
MCSE, MCDBA
-
July 13th, 2001, 04:35 PM
#5
Re: MsgBox Problem
Cool, that works too! But I didn't type Option Explicit into my code. Could my VB design environment be using it automatically I wonder?
The more you know, the more you know you don't know.
The more you know, the more you know you don't know.
-
July 13th, 2001, 05:46 PM
#6
Re: MsgBox Problem
I made a mistake just now. It is VB system not "Option Explicit" that not allow brackets without "Call" when there is no return value or you don't want to get it. But in VB.NET, the need for the Call word will be removed. Let's look and see.
Regards,
Michi
MCSE, MCDBA
-
July 13th, 2001, 06:08 PM
#7
Re: MsgBox Problem
Yea, Option Explicit has nothing to do with brackets used in calling functions. Option Explicit has to do with variables being declared before initialization.
Brackets will be used in calling a function when prefixed with the "Call" directive, or when used in an equasion. For example
Call MsgBox("Hello World")
Dim Response
Response = MsgBox("Hello World")
You should get used to using the "Call" directive and using brackets when calling functions. It is common in almost every other programming language, and will be implemented in VB.NET
Good luck!
John Peloquin
Peloweb.com
[email protected]
"Always remember to lock your keys in your car so little elves don't come and steal them out of your pocket" - Alexander Graham Bell
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
|