473,386 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MsgBox

I wanted to make a pop up box to verify a choice to delete a database
record, so I tried this code:

Dim Result As MsgBoxResult
Result = MsgBox("Are You Sure?", MsgBoxStyle.OkCancel, "Sure?")
If Result = MsgBoxResult.Ok Then
Else
End If

The error I got was:

Showing a modal dialog box or form when the application is not running
in UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a
notification from a service application.

I dont understand this message. How would I make a message box like this
work? I figured doing the code may render some kind of javascript on the
client side but I guess not (I was hopeful though).
Sep 13 '06 #1
2 4484
You have to use javascript. Your in the web world now.

Take a look at teh code below.

Regards

John Timney (MVP)
http://www.johntimney.com
html>
<head>
<script language="VB" runat="server">
'Sub Page_PreRender()
Sub Page_Load( sender as Object,e as EventArgs)
'Form the script that is to be registered at client side.
Dim scriptString as String = "<script language=JavaScriptfunction
DoClick() {"
ScriptString += "var truthBeTold = window.confirm('Click OK to continue.
Click Cancel to stop.');"
ScriptString += "if (truthBeTold)"
ScriptString += "window.alert('Welcome to MVP World!');"
ScriptString += "else window.alert('Bye from MVP World!');}<"
scriptString += "/"
scriptString += "script>"
If(Not IsClientScriptBlockRegistered("clientScript"))
RegisterClientScriptBlock("clientScript", scriptString)
End If
End Sub
</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<input type="button" value="ClickMe" onclick="DoClick()">
</form>
</body>
</html>

"Jim in Arizona" <ti*******@hotmail.comwrote in message
news:uo*************@TK2MSFTNGP06.phx.gbl...
>I wanted to make a pop up box to verify a choice to delete a database
record, so I tried this code:

Dim Result As MsgBoxResult
Result = MsgBox("Are You Sure?", MsgBoxStyle.OkCancel, "Sure?")
If Result = MsgBoxResult.Ok Then
Else
End If

The error I got was:

Showing a modal dialog box or form when the application is not running in
UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a notification
from a service application.

I dont understand this message. How would I make a message box like this
work? I figured doing the code may render some kind of javascript on the
client side but I guess not (I was hopeful though).

Sep 13 '06 #2
John Timney (MVP) wrote:
You have to use javascript. Your in the web world now.

Take a look at teh code below.

Regards

John Timney (MVP)
http://www.johntimney.com
html>
<head>
<script language="VB" runat="server">
'Sub Page_PreRender()
Sub Page_Load( sender as Object,e as EventArgs)
'Form the script that is to be registered at client side.
Dim scriptString as String = "<script language=JavaScriptfunction
DoClick() {"
ScriptString += "var truthBeTold = window.confirm('Click OK to continue.
Click Cancel to stop.');"
ScriptString += "if (truthBeTold)"
ScriptString += "window.alert('Welcome to MVP World!');"
ScriptString += "else window.alert('Bye from MVP World!');}<"
scriptString += "/"
scriptString += "script>"
If(Not IsClientScriptBlockRegistered("clientScript"))
RegisterClientScriptBlock("clientScript", scriptString)
End If
End Sub
</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<input type="button" value="ClickMe" onclick="DoClick()">
</form>
</body>
</html>

"Jim in Arizona" <ti*******@hotmail.comwrote in message
news:uo*************@TK2MSFTNGP06.phx.gbl...
>I wanted to make a pop up box to verify a choice to delete a database
record, so I tried this code:

Dim Result As MsgBoxResult
Result = MsgBox("Are You Sure?", MsgBoxStyle.OkCancel, "Sure?")
If Result = MsgBoxResult.Ok Then
Else
End If

The error I got was:

Showing a modal dialog box or form when the application is not running in
UserInteractive mode is not a valid operation. Specify the
ServiceNotification or DefaultDesktopOnly style to display a notification
from a service application.

I dont understand this message. How would I make a message box like this
work? I figured doing the code may render some kind of javascript on the
client side but I guess not (I was hopeful though).

Thanks John. I'll make good use of it.
Sep 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Bassett | last post by:
In my ASP script I call Javascript for a msgbox after the user has submitted the form of their resume information. I saw this example as a way to get a msgbox onto the client from ASP since server...
3
by: JT | last post by:
im trying to use the MsgBox function in the following to display an ASP MsgBox containing text retrieved from the db into a recordset <% set rsMessages= myRecordset msg_text =...
2
by: js | last post by:
Hi all, I currently encounter a problem and it is urgent to me. After calling the MsgBox.Show(), the message box is shown with non-modal mode, what is the possible reason??? This only happen...
4
by: Lakrom | last post by:
Hi to all, how to put msgbox in this asp page, this send me a message Denied permission: 'MsgBox' <% Set Conn=server.createobject("ADODB.connection") Conn.open application("StrConRuta") set rs =...
6
by: Lapchien | last post by:
In this bit of code provided so helpfully by Nath: Private Sub Command118_Click() Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.openrecordset("IMPORT")
8
by: deko | last post by:
Can I close a MsgBox with VBA Code? Something like: If IsOpen (MsgBox, "Title") Then Close(MsgBox, "Title") Run some code Else Run other code End If Can this be done in VBA? Do I need to...
2
by: Radith Silva | last post by:
I need to use the MsgBox function like I used to in VB 6.0 So all i do is: MsgBox ("Please provide Input") BUT IN .NET: The error reads "msgbox is a namespace"
4
by: James | last post by:
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!
9
by: Ivan Jericevich | last post by:
In my code below at the line 'response' a blip sound is heard and the program exits the sub -- No MsgBox is displayed. What am I doing wrong? If nonNumberEntered = True Then msg = "Enter...
2
by: perkykoala | last post by:
I apologize in advance for being REALLY detailed/verbose. It's the result of staring/tweaking code for too long. Using VB 2005: I need to design a multiple choice test (unfortunately, I can't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.