GEOG 490/590

GIS Programming

Exercise 2: VB .NET Syntax

In addition to working with the GUI controls in the IDE, developing a computer application does require some coding, that is, you do need to write computer codes using the correct syntax and algorithms. This exercise lets you practice some basic VB syntax. A good programmer always writes some codes to enforce and verify the programming knowledge s/he just learned. Please make this a habit when you read something new about VB .NET.

Do the Try it on the VB Online help of the following topics (use the hyperlinks or these topics as the keywords when searching the VB 2008 Express MSDN online help). The Windows Application that you are instructed to create is shown as Windows Forms Applications in the VB template panel.

  1. "Representing Words, Numbers, and Values with Variables" - create variables and display their values
  2. "Words and Text: Using String Variables to Organize Words" - join strings
  3. "How to: Determine the String Associated with an Enumeration Value" - determine the string associated with an enumeration (do the Visual Basic example)
  4. Create a Windows form that contains 3 buttons. Associate the buttons with the 3 procedures you created in Steps 1, 2, and 3. When you have fully tested the program, locate the executable (.exe) and run it. The executable file can be found in the bin\Debug folder of your project. Try various ways of getting the codes created in different projects into one project (e.g., copy and paste, or add existing item).

Additional notes to step 3:

To run the TestMethod() subroutine, you need to have an event to trigger it. The subroutine doesn't have input arguments. You can just insert the code "TestMethod()" in any procedure associated with a GUI event, such as the Load event of a Window form or the Click event of the form (or a button on the form).