GEOG 490/590: GIS Programming

 

Lab1. Hello World

Due Oct 9 before class.

 

Introduction:

 

You will use an ESRI Virtual Campus course to learn MicroSoft Visual Basic (VB6) programming language. We don’t have VB6 on our lab computers, so you will do the exercise in ArcMap VBA environment. VB6 and VBA have almost identical IDEs. However, there are major differences between VB6 and VBA. For example, if you don’t have VB6 installed on your computer, then you don’t have access to many commonly used GUI controls. As a result, we will skip several lab exercises in the Virtual Campus course. Please frequently refer to the Lab Instructions Update below while working on this lab.

 

Although many of the lab instructions do not ask you to repeat (or experiment with) the tasks, it will help you understand the topic if you do it and experiment with it. Also, don’t be shy from using MicroSoft Visual Basic Help that comes with ArcMap VBA. It’s a good starting point when you need help with VB codes. EDN has a huge collections on ArcObjects and VB(A) references. That’s the place you have to check out.

 

Make sure you put your lab data in a folder in the C:\Users folder and regularly back up your data to your H drive or portable device.

 

Instructions:

 

You will use your access code to take the “Introduction to Visual Basic 6” course online. For Lab1, you only need to finish modules 1 and 2. Since we are using VBA instead of VB6, please follow the steps below to access the VBA IDE in ArcMap.

1.          Start ArcMap.

2.          Select Tools from the pull-down menu, then select Macro, and then Visual Basic Editor. The VBA IDE appears.

3.          You first insert a form into your project. Select Insert -> UserForm to insert the form. Now you will see a form and a toolbox containing several Controls that you can add to the form. Hover the mouse cursor over these Controls and see what they are.

4.          Now you can take the ESRI online course and experiment with VB codes.

5.          To save your VB programs, just close the VBA IDE window and save the ArcMap project (e.g., Lab1.mxd).

 

Once you have ArcMap VBA environment setup, use following instructions to access the course on ESRI Virtual Campus.

1.          Go to http://training.esri.com. Click "Go to My Training." Under My Courses click "My Virtual Campus Courses." If you already have an ESRI Global Account, log in using your username and password. If you do not, click "Create New Account."

2.          Click "Start a new course". Type your 14-character Course Access Code in the field provided and click "Go." Follow the instructions on your screen. See the table at the end of the instruction for your Access Code.

3.          From your course list, click the course title “Introduction to Visual Basic 6” to begin.

 

Lab Instructions Update:

 

In Module 1:

1.          Skip Explore the slide show application.

2.          Skip Saving Visual Basic projects.

3.          Skip Design the form to browse files.

4.          In the Object Browser topic, select a different library (e.g., VBA) and continue with the instructions.

5.          Skip Browse and add files for the slide show application.

 

In Module 2:

1.          Skip Add a toolbar using Toolbar and Imagelist Controls.

2.          Skip Code the buttons on the toolbar.

 

Lab Deliverables:

 

Submit the documents listed below in a zipped file. To create a zipped file in Windows XP, go to your work folder and click the right-mouse-button. Select New and then “Zipped (Compressed) Folder” to create a zipped folder. You can just copy and paste the files into the zipped folder.

1.          Your mxd file that contains the AP that has the following functions..

1)      A UserForm containing the DMS to DD function.

2)      A second UserForm that has a ListBox and two buttons: Add text and Clear. When the Add text button is clicked, an InputBox pops up and let users enter some texts and then add the texts to the ListBox. When users click the Clear button, all the texts in the ListBox disappear.

3)      Each line of your code in the first and second UserForms must have a comment describing what the code is about.

4)      A third UserForm containing the complete Retirement Fund Calculator.

 

2.          A report of the following questions:

1)      You used MsgBox function to display messages. In one of the example, the text uses a constant called “vbYesNo.” What value does the constant represent? What are the possible return values when you used the vbYesNo button setting in the MsgBox function? Please use the ArcMap VBA online help or write a small program to find the answer.

2)      Describe the effect and purpose of “Option Explicit” statement.

 

Introduction to VB6 Access Codes:

 

Student

Access Code

Alejandro

 

Amarina

 

Caroline

 

Chad

 

Charles

 

Chris

 

Craig

 

Heath

 

Jessica

 

Karen

 

Loren

 

Luis

 

Rob Menke

 

Robert Chappell

 

Ron

 

Thomas

 

Tyler