An introduction to programming in Visual Basic AGEC 637 – Summer…

An introduction to programming in Visual Basic AGEC 637 – Summer… page 1 An introduction to programming in Visual Basic AGEC 637 – Summer… page 2 An introduction to programming in Visual Basic AGEC 637 – Summer… page 3

Introduction. The purpose of this tutorial is to provide you with the basic tools needed to write very simple. programs in Visual Basic (VB). …

More PDF Content

An introduction to programming in Visual Basic AGEC 637 – Summer 2008 I. Introduction
Page 1
This document was generated at 10:35 AM on Thursday, July 24, 2008 An introduction to programming in Visual Basic AGEC 637 – Summer 2008 I. Introduction The purpose of this tutorial is to provide you with the basic tools needed to write very simple programs in Visual Basic (VB). They are designed for version of VB that comes with MS Office 2003. If you’re running a more recent version, these instructions may not work in exactly the same way. VB is extremely powerful and can create nice user interfaces and do lots of fancy formatting. There are a number of references that can help you learn these tools. In particular, I find the book by Albright to be quite useful. Fortunately, for the work we’ll be doing in this class, the vast majority of these tools will be unnecessary and the next several pages should be enough to get you started. As you’re working through this sheet, make sure you understand what you’re doing. You’ll need to follow these or similar steps many times in the future. If you understand instead of just repeating, you’ll be much happier in the long run. There is a quiz at the end of these notes that students enrolled in 637 must complete before I will give programming help on their homeworks. If you have trouble completing the quiz, you may of course request help on that. II. Overview VB has much in common with virtually all other programming languages. A VB program is a series of commands that creates and manipulates variables. Several different programs (called Subs in VB) can be in a single file, and they can be entirely separate or interconnected. With few exceptions, all your commands must be contained in a Sub, i.e., after a line that opens a Sub and before the End Sub that ends the sub. Unlike the command-prompt version of Matlab, a VB program doesn’t run until you tell it to. Further, it doesn’t give any output unless you explicitly tell it what output to give and where to put it. III. A word of warning!!! 1. Save your work every 5-10 minutes. There is usually no autosave working in Excel and even if it is, don’t trust it. VB programs frequently crash, taking hours of work with them. IV. First step – your first program for writing output 2. Open Excel, then go to the Tools menu, click on Options, then the Security Tab. Click on the Macro Security button then select Medium from the list of options. Indicate OK. From now on you will be prompted when you open a spreadsheet with macros attached. Sometimes you’ll need to exit Excel and then start again. 3. Start with a blank worksheet and save it (e.g., VBintro.xls). 4. Load the VB editor (alt-F11).
Page 2
2 5. From the Tools menu, choose the options and on the Editor page, select “Require Variable Declaration.” (Tools, Option 2nd box on the editor page). Click Ok. This means that every time you use a new variable, you need to explicitly introduce that variable with a Dim command, just like you had to do in Matlab with the syms command before using a variable. 6. Make sure that you are Viewing the Project Explorer and make sure that your current project is highlighted in the project explorer. If the Project Explorer is not visible, press Ctrl-R to view it. 7. Using the Insert menu, Insert a module (not a class module). The module should appear under your file in the Project Explorer window (on the left). The words Option Explicit should appear at the top of screen, indicating that variable declaration is required. If not type them in. This is the work space where you will write your programs. You can have as many modules as you like and can interact between modules in other programs. 8. In the editor, type the words sub FirstProgram and press [enter]. This will create your first subroutine. Note that the editor automatically completes the lines and writes Sub FirstProgram() End Sub VB automatically puts

Processing your request, Please wait....

Download PDF eBook

PDF | Source » agecon2.tamu.edu | 12 pages | 84.35 KB |

PDF files Related to this topic:

  1. Tutorial: Learning to Program Amos with Visual Basic Tutorial: Learning to. Program Amos with Visual. Basic. Purpose. You...
  2. Tutorial: Programming in Visual Basic 6.0 Tutorial: Programming in Visual Basic 6.0. This tutorial contains a...
  3. Tutorial: Learning to Program Amos with Visual Basic Visual FORTRAN or Borland Delphi. 1 . The program that...
  4. Programming Acrobat JavaScript Using Visual Basic Programming Acrobat JavaScript Using Visual Basic Acrobat 7.0 provides a...
  5. Access Tutorial 12: An Introduction to Visual Basic the same. This tutorial is an introduction to a handful....

Related Search Term:java socket programming ebook, Java network programming free pdf, Java server Programming allamaraju+pdf, Allamaraju Java Server Programming rapidshare, maple programming book pdf, introduction to ajax in pdf file, Maple 12 Advanced Programming Guide rapidshare, e-book introduction to maple, introduction to javascript Fletcher, introduction Maple 11,

Leave a Reply