Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / June 2005

Tip: Looking for answers? Try searching our database.

Msgbox On Windows Server 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daryl Zavier - 13 Jun 2005 08:00 GMT
Hi Guys,

I'm really new to .Net development and need your advise on this.

Recently I've completed a web application using VB.net (Visual Studio .Net
2003). In the application whenever the user clicks the delete button, a
msgbox will appear prompting the user to confirm the deletion via the Yes or
Cancel button.

On my own machine (Win 2k IIS5), the msgbox appears without any issues.
However when I deploy the application on a Windows Server 2003 machine, the
msgbox will not appear and a event will be captured in the system log as
"Application Popup" containing the text that I wanted to display (e.g. Do you
really want to delete this user record?).

Can anyone help me out on this? Many thanks in advance!!!
Norman Yuan - 13 Jun 2005 15:52 GMT
If it runs as WEB app on your computer (Your browser->IIS->your browser) and
the messagebox pops up inside browser, there is not reason it would not work
when you move your app to Win2003, after all, the messagebox is displayed by
the browser, not server.

Now that you see the app log on the server, that definitely means your code
is entirely wrong: you are trying to show message box on the server, which
is not allowed (even it is allowed, is the user going to fly to the server
possibly located at the other side of the world to click OK/Cancel and fly
back to continue?). If you could show some code on how the message box is
displayed, the problem could be explained clearer.

> Hi Guys,
>
[quoted text clipped - 12 lines]
>
> Can anyone help me out on this? Many thanks in advance!!!
Daryl Zavier - 14 Jun 2005 01:56 GMT
Hi Norman,

A sample of my code is below, appreciate your help thanks!

"Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
       Dim Response As MsgBoxResult
       Response = MsgBox("Do You Want To Delete This User?", 131108,
"Confirm User Deletion")
       If Response = MsgBoxResult.Yes Then
           SqlCommandUserDelete.Parameters("@UserNo").Value = TextBox5.Text
           SqlCommandUserDelete.Connection.Open()
           SqlCommandUserDelete.ExecuteNonQuery()
           SqlCommandUserDelete.Connection.Close()
...."

> If it runs as WEB app on your computer (Your browser->IIS->your browser) and
> the messagebox pops up inside browser, there is not reason it would not work
[quoted text clipped - 27 lines]
> >
> > Can anyone help me out on this? Many thanks in advance!!!
Norman Yuan - 14 Jun 2005 04:25 GMT
Obviously, you used MsgBox of Windows App style. Web app is a server/client
type app that is significantly different from Window app. The
Button5_Click() runs at web server side (as I previously pointed out, the
server is beyond of user's reach and user cannot see your messagebox show on
the server screen, if there is a screen and if the server allows you to show
messagebox). For a web app, when the Button5_Click() is run, that means user
has already clicked the button and the web page(form) has already been send
to the web server. To display MessageBox like you want, you need client side
code that run by web browser. Common practice is to attach a piece of client
side code (javascript, or other script language the browser can run) to the
"Delete" button. Here is an example:

Private Page_Load(....)
{
   if (!Page.IsPostBack)
   {
       ....
       Button5.Attributes.Add("onclick","return confirm('Do you really want
to delete this?');");
   }
}

The example is in C#, hope you have no problem interpret it into VB.NET. In
ASP.NET, if a web control (button) has client side code attached, if it get
clicked, client side code runs first before the control causes postback. If
the client side code returns "false", the postback will be cancelled.
comfirm() is a standard javasript messagebox function.

You really SHOULD NOT use Miscrosof.VisualBasic namespace in ASP.NET app. It
is meant largely for Windows app and for back compatibility to lure VB6
programmers to .NET platform. I'd suggest to forget it entirely.

> Hi Norman,
>
[quoted text clipped - 43 lines]
> > >
> > > Can anyone help me out on this? Many thanks in advance!!!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.