1.8. Call Methods at Design TimeAlthough Visual Studio .NET 2003 included the Immediate window, you couldn't use it to execute code at design time. Longtime VB coders missed this feature, which was a casualty of the lack of a background compiler. In Visual Studio 2005, this feature returns along with the return of a background compiler. Note: Need to try out a freshly written code routine? Visual Studio 2005 lets you run it without starting your project. 1.8.1. How do I do that?You can use the Immediate window to evaluate simple expressions, and even to run subroutines in your code. To try out this technique, add the following shared method to a class: Public Shared Function AddNumbers(ByVal A As Integer, _ ByVal B As Integer) As Integer Return A + B End Sub By making this a shared method, you ensure that it's available even without creating an instance of the class. Now, you can call it easily in the design environment. By default, the Immediate window isn't shown at design time. To show it, select Debug Figure 1-11. Executing code at design time![]() When you execute a statement like the one shown in Figure 1-11, there will be a short pause while the background compiler works (and you'll see the message "Build started" in the status bar). Then the result will appear. Note: The expression evaluation in the beta release of Visual Studio 2005 is a little quirky. Some evaluations won't work, and will simply launch your application without returning a result. Look for this to improve in future builds. 1.8.2. Where can I learn more?The MSDN help includes more information about supported expression types at the index entry "expressions |