Table of contents

使用即时窗口Use the Immediate Window

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

即时窗口中显示生成从调试语句在代码中的或直接在窗口中键入命令的信息。The Immediate window displays information resulting from debugging statements in your code or from commands typed directly into the window.

若要显示即时窗口To display the Immediate window

  • 视图菜单中,选择即时窗口 (CTRL + G)From the View menu, choose Immediate window (CTRL+G)

在立即窗口中执行代码To execute code in the Immediate window

  1. 即时窗口中键入代码的行。Type a line of code in the Immediate window.

  2. 按 Enter 执行该语句。Press ENTER to execute the statement.

使用即时窗口:Use the Immediate window to:

  • 测试有问题的代码或新编写的代码。Test problematic or newly written code.

  • 查询或运行应用程序时更改变量的值。暂停执行,而将变量赋新值像在代码中。Query or change the value of a variable while running an application. While execution is halted, assign the variable a new value as you would in code.

  • 在运行应用程序时查询或更改属性值。Query or change a property value while running an application.

  • 像在代码中调用的过程Call procedures as you would in code.

  • 在运行程序时查看调试输出。View debugging output while the program is running.

    请注意即时窗口语句的上下文中执行 — — 即,如同它们在特定模块中输入。NoteImmediate window statements are executed in a context — that is, as if they are entered in a specificmodule.

如果在即时窗口中工作时的函数、 语句、属性方法需要在语法上的帮助,选择关键字、 属性名或方法名,然后按 F1。If you need help on syntax for functions, statements, properties, or methods while working in the Immediate window, select thekeyword, the property name, or the method name, and press F1.

© 2018 Microsoft