?
Solved

Use Msgbox

Posted on 2003-03-13
9
Medium Priority
?
366 Views
Last Modified: 2010-04-07
hi, waht i have to do to use the msgbox functions in my asp codes?

It returns to me: permisson denied 'MsgBox'

the code i wrote is:

<%
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to continue ?"   ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2   ' Define buttons.
Title = "MsgBox Demonstration"   ' Define title.
Help = "DEMO.HLP"   ' Define Help file.
Ctxt = 1000   ' Define topic
      ' context.
      ' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then   ' User chose Yes.
   MyString = "Yes"   ' Perform some action.
Else   ' User chose No.
   MyString = "No"   ' Perform some action.
End If
%>

Thanks!
0
Comment
Question by:EM77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 8127010
Hi EM77,

You cannot use a message box in server side scripting such as ASP. You must use it on the clientside. Also, you cannot use "Response" as a variable, this is the built-in response object in ASP and trying to assign the result of a message box to it will give odd results if not errors.

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8127015
<%
Dim Msg
Msg = "Do you want to continue ?"
Response.Write "<script>alert('The Message')</script>"
%>
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8127020
<%
Dim Msg
Msg = "Do you want to continue ?"
Response.Write "<script>alert(" & Msg & ")</script>"
%>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:EM77
ID: 8127067
Ok, what i have to do to run msgbox in client side?
The javascript alert do'nt help me, there is one single option to do with de alert message: "accept". I need to analize the optiont that the user send.

Thanks!"
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8127085
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 8127102
You need to use your asp page to create html which will cause the msgbox to be displayed. :

<%
Response.Write "<HTML><SCRIPT LANGUAGE=VBSCRIPT>Sub document_onload() R=Msgbox (""Do You Want To Continue"",vbYesNo) If R=vbYes Then ... Else .... End If End Sub</SCRIPT><body>Some Body text if appropriate</BODY></HTML>"
%>

This will create an html page that should display the msgbox. You can then play with this to get it to react based on the button pressed in the message box.

Alternatively you can do something similar with HTML forms within your asp page and act on things accordingly.

You might actually have been better off posting this in the ASP topic area rather than VB as there are a number of differences between the way ASP and VB works.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 8127133
aelatik's link will also help, you need to use ASP to write this to the html page as I show above though unless you want to ignore ASP and do something else.
0
 
LVL 4

Expert Comment

by:iozturk
ID: 8127169
In msdn.microsoft.com

search for "window object" and "showModalDialog Method"

showmodalDialog is what you want I think.
0
 
LVL 5

Accepted Solution

by:
avya2k earned 200 total points
ID: 8127237
msgbox is not supported for client side scripting in VBScript also if u use it in client side ,i think only IE supports vbscript sobetter use in javascript as follows

ret=window.confirm("Do you want to continue?")
if(ret==true)
{
  alert("yes is pressed")
  form.submit
}
else
  alert("no is pressed")
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question