Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

Step 3: Creating Your Program's Executable File

Now, if you're done patting yourself on the back and yelling for the family to come and fuss over your first Visual Basic .NET program, you can take the step that converts your Visual Basic .NET project into a full-fledged, standalone Windows application.

Actually, just by running the program, you created the application's executable. However, this version of the program has a lot of extra data, called debugging information, stored in the executable file. While this information is handy when you're working on a program, it does take up a lot of extra space when the program's done. (You'll learn about debugging when you get to Chapter 17, "Mastering the Art of Bug Extermination.")

If you look next to the button you clicked to start your program (on the toolbar), you'll see a box that contains the word "Debug." This box tells you that you're currently working with the debug version of the program. Click the little arrow to the right of the box, and select Release from the list that appears, as shown in Figure 3.11.

Now, in the Build menu, you'll see a command called Build MyProgram, where MyProgram is the name of the current project as shown in Figure 3.12.

Click the Build MyProgram command. When you do, Visual Basic .NET changes your program into an executable Windows application, which no longer contains the extra debugging information.

Figure 3.11Figure 3.11 The Release configuration creates a smaller executable file that doesn't contain debugging information.

Figure 3.11Figure 3.12 The Build MyProgram command changes your program into an executable file.

Now that Visual Basic .NET has converted your program to an executable file, you don't need Visual Basic .NET to run the program. To prove this, first save your program. To save your program, you have three options. You can ...

  • Click the Save All button in the toolbar (that's the button that looks like a stack of floppy disks, remember?).

  • Select the File menu's Save All command.

  • Press Ctrl+Shift+S on your keyboard.

Now you can exit from Visual Basic .NET by closing its window. Visual Basic .NET vanishes from your screen and is now closed. The executable program file you just created with the help of Visual Basic .NET, MyProgram.exe, is located in your Visual Studio Projects\MyProject\bin folder (assuming you chose the default location when you started the project). Double-click the file, and your Visual Basic .NET application appears on the screen. Go ahead and click the Command1 button to display the message box. It works! Break out the champagne and cheese fondue!

The Least You Need to Know

  • To create a Visual Basic .NET application, you build a user interface, write the program source code, and then compile the program into an executable file.

  • You build a user interface by placing controls from the Visual Basic .NET toolbox onto your program's form.

  • You can resize controls (and the form) by dragging the control's sizing handles, which appear when the control is selected.

  • One way to display the code window is to double-click the object for which you want to write program code.

  • When the user clicks a button, Visual Basic .NET generates a Click event. The program code you add to the button's Click event procedure determines what the button does.

  • The Build menu's Build (or Rebuild) command converts your Visual Basic .NET program into a standalone Windows application.

  • + Share This
  • 🔖 Save To Your Account