C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback


Recent Articles

C++ - No Fears And Great Books
This is a quick look at a couple of stories on C++, namely why programmers should not feel The Fear of native code, and a quintet of books that should occupy the bookshelves of quality C++ coders.

New NetBeans Pack Supports C/C++
Developers who work in C or C++ can use the NetBeans integrated developer environment to build applications on Windows, Linux...
Computer Programming As Art
This isn't about programming the visuals for the next great Pixar release, or even creating ASCII art...

Microsoft Provides Coders With Robotics Studio
The company recently announced its community technology preview of its Robotics Studio...

Source Code Needs A Place To Stay
This isn't a chapter in the CVS versus Subversion debate, but a look at places online to view useful pieces of code.

Search Engines C Demand For Programmers
The need for C/C++ programmers varies among the major search engine companies; Horace Greeley's advice to go West definitely applies here.

Two Routes To C On Supercomputers
Both routes to programming in C on supercomputers will move through Silicon Graphics, as SGI works with a couple of firms to promote its blade hardware.


08.31.06


Using Immediate Window To Work With Values


By Joel Murach

This article is an excerpt from the book: Murach's ASP.NET 2.0 Web Programming with C# 2005.

The Immediate window, shown in figure 4-14, is useful for displaying the values of variables or properties that don't appear in the Code Editor window. To display a value, you simply type a question mark followed by the name of the variable or property. The first line of code in this figure, for example, displays the Text property of the item selected from the Products drop-down list. You can see the result in the second line of this window.

The Immediate window is also useful for executing C# statements. For example, you can execute an assignment statement to change the value of a variable or property. After I displayed the Text property of the Quantity text box, for example, I assigned a value of 1 to this property. Similarly, you can execute a user-defined method. This can be useful for testing the result of a method with different arguments. If you execute a method that returns a value, you can also preface the method name with a question mark to display the value it returns.

When you enter commands in the Immediate window, they're executed in the same context (or scope) as the application that's running. That means that you can't display the value of a variable that's out of scope. If you try to do that, the debugger displays an error message.

The commands that you enter into the Immediate window remain there until you exit from Visual Studio or explicitly delete them using the Clear All command in the shortcut menu for the window. That way, you can use standard Windows techniques to edit and reuse the same commands from one execution of an application to another without having to reenter them.

The Casino Affiliate Convention
Register Early and save!

To execute a command that you've already entered in the Immediate window, just use the Up and Down arrow keys to scroll through the commands. As you scroll, the commands are displayed at the bottom of the window. Then, you can change a command if necessary and press Enter to execute it.

The Immediate Window

Description

• You can use the Immediate window to display and assign values from a program during execution. To display this window, click on the Immediate Window tab or use the DebugWindowsImmediate command.

• To display a value in the Immediate window, enter a question mark followed by the expression whose value you want to display. Then, press the Enter key.

• To assign a different value to a variable, property, or object, enter an assignment statement in the Immediate window. Then, press the Enter key.

• To execute a user-defined method from the Immediate window, enter its name and any arguments it requires. Then, press the Enter key. If you want to display the value that's returned by a method, precede the method call with a question mark.

• To reissue a command, use the Up and Down arrow keys to scroll through the commands until you find the one you want. Then, modify the command if necessary and press the Enter key to execute it.

• To remove all commands and output from the Immediate window, use the Clear All command in the shortcut menu for the window.


About the Author:
Joel Murach has been writing and editing for more than 10 years. During that time, he sharpened his programming skills as a contract programmer in San Francisco and his instructional skills as a trainer for HarperCollins Publishing. He always brings a vision to his projects that leads to improved effectiveness for his readers.

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com


-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2006 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


">Unsubscribe from CProgrammingTrends.
To unsubscribe from CProgrammingTrends or any other iEntry publication, simply send an email request to: support@ientry.com
> CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact