spacer
Yehuda Shiran August 22, 2002
Using the MessageBox Class
Tips: August 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

You're probably well acquainted with the alert() method you use so often in client-side JavaScript code. The alert() method is great for debugging scripts the good old-fashioned way--tracing variables by displaying their values along the flow. JScript .NET provides similar capabilities via the System.Window.Forms.MessageBox.Show() method. You pass this method a single argument, a string, and it pops up a window displaying this string and an OK button.

The message box is called modal. A window or a form is modal if it retains the focus until you explicitly close it. It's a common practice to make dialog boxes and messages modal, since you want to make sure the user reads the message before he or she continues working with the application.

The show() method belongs to the class MessageBox, of the System.Windows.Forms namespace. Import this namespace before you work with the MessageBox class, so you don't have to specify the fully-qualified name. As print and System.Console are available only from JScript .NET code that is compiled and run from the command line, so is the System.Windows.Forms namespace. It is not available from ASP.NET pages or from Code Behind JScript .NET code.

To learn more about JScript .NET and ASP.NET, go to Column 116, JScript .NET, Part IX: Displaying Information.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint