Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Use Msgbox

Posted on 2003-03-13
9
Medium Priority
?
373 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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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
Course of the Month11 days, 14 hours left to enroll

564 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