MsgBox

I am trying to use the Msgbox in VbScript but I get the following error:
Microsoft VBScript runtime error '800a0046'
Permission denied: 'msgbox'
Is Msgbox part of vbscript?
Cheers
Rob
[246 byte] By [Rob@SYPTE] at [2007-11-17 13:11:04]
# 1 Re: MsgBox
it is, but only on the client side - if you try to pop up a MsgBox on the server (in between the <% and %> signs) you'll freeze the server.

john

John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
Johnny101 at 2007-11-9 11:37:56 >
# 2 Re: MsgBox
Cheers for that

How do I pop one up on the client side (and get a response) if all the rest of the script is running on the server?

Regards

Rob
Rob@SYPTE at 2007-11-9 11:38:57 >
# 3 Re: MsgBox
Well, you could send down the VBScript code in Response.Write statements to show the message box, but then your code would only work in IE browsers. Generally, when a question needs to be presented to the user, an intermediate asp page is used. Populate the asp page with the question and then a submit (or a couple depending on the question) and then continue your processing based on what button was clicked.

hope this makes sense,

john

John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
Johnny101 at 2007-11-9 11:39:56 >
# 4 Re: MsgBox
Thanks I tried this: Response.Write reply = msgbox ("Hello")
but it still gave a permission denied error, I'm not too bothered if it only works on IE as it's for an intranet where all users have IE5, any other ideas would be grateful.

Cheers

Rob
Rob@SYPTE at 2007-11-9 11:40:51 >
# 5 Re: MsgBox
you have to send it down as string information. like this:

response.write "<script language=vbscript>" & vbcrlf
response.write "sub document_onload()" & vbcrlf
response.write "dim reply" & vbcrlf & "MsgBox(" & Chr(34) & "Hello" & Chr(34) & ")" & vbcrlf
response.write "end sub" & vbcrlf
response.write "</script>" & vbcrlf

if i remember correctly, the document_OnLoad procedure gets called automatically, but i could be wrong about that. in any case, you have send down all the code in a string format (becuase that's all the response.write can handle). it will be become actual code on the client side.

hope this helps,

john

John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
Johnny101 at 2007-11-9 11:42:01 >