Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 35,056 times

Contents

Related Categories

Debugging - Immediate Window

Immediate Window

You can use the immediate window in VB to get the current values of variables and to run other code. To show it click View | Immediate. You can only use the immediate window when code execution is paused.


Immediate Window

Entering a ? and then the variable name or property will return its value, press RETURN to execute the query. The text below will return the path of your application, the text in italics is a possible result. Values in Italics are return results.

? App.Path
C:AppPathApp.EXE

The following example will return the value of the caption property:

? Label1.Caption
&Cancel

or perform calulations using variables or just numbers:

? Text1 * 10
198
? 100 / 1.92
52.0833333333333

You can also run one line or multiple statements. For example:

frmMain.Visible = False

To enter multiple lines of code, without it executing immediately press CTRL+Return

Below are a few examples

' This will return the number of Forms loaded into the memory
? Forms.Count
' This will return the name of Form(0) which is stored in the memory
? Forms(0).Name
' This will display a message box
Msgbox "hello"

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments