If you are a novice Visual Basic programmer, you may need more information than this book can provide. However, since Visual Basic is one of the most popular programming languages in the world, there are many, many sources of information available.
You already have two excellent sources of VBA information installed on your computer. The Visual Basic for Applications Help file that ships with DeltaV Operate contains an enormous amount of information. You can launch this help file by selecting the Microsoft Visual Basic Help command from the Visual Basic Editor's Help menu. Throughout this manual, topics are listed in the Visual Basic for Applications Help file that you should explore if you want to learn more about programming in Visual Basic.
Once you are ready to begin coding, you will undoubtedly need more information on the objects, properties, methods, and events that are specific to DeltaV Operate. You can find this information in the Automation Interfaces Help which is located in the Help and Information folder of the DeltaV Operate system tree. You can also select the Automation Help command from the Visual Basic Editor's Help menu. If you don't have DeltaV Operate running, you can launch this Help file directly by double-clicking FIXVBA.CHM in the NLS path (\DeltaV\iFIX\NLS).
The Visual Basic for Applications Help file should not be confused with the Automation Interfaces Help file. The VBA Help file is a reference for the Visual Basic for Applications user interface and programming language only; it does not contain any information about how VBA has been integrated into DeltaV Operate. On the other hand, the Automation Interfaces Help file is dedicated to the objects, properties, methods, and events that are specific to DeltaV Operate, but does not teach fundamental VBA programming concepts.
There are over 900 Visual Basic titles available, some of which may be carried (or can be ordered) by a bookstore in your area. Two books that provide useful information about Visual Basic are:
The Internet provides a wide range of valuable information about VBA, including tutorials for beginners, book lists for advanced users, and source code segments for developers. One of the best sources of information is the Microsoft website (http://www.microsoft.com).
The Visual Basic newsgroups are popular sources of information on the VB programming language as well. These forums are great for interacting with other Visual Basic programmers, and offer an excellent way to post a particular issue and get it answered by a programming expert. To find them, filter the newsgroup list by specifying any of the following words: "vb", "visual", "basic", and "visual basic".
The topic Working with the Scheduler and the DoEvents Function contains example code that illustrates how to run several scripts at the same time in the single-threaded environment of VBA using the Scheduler application. After reading this section, you may want to refer to the Mastering DeltaV Operate topics to learn more about how to use the Scheduler.
One of the best ways to learn any programming language is to examine code that already exists and try to decipher how it works. This manual contains a great deal of sample code that you can cut and paste directly into the Visual Basic Editor. The following is a list of the sample scripts included in this manual. Some topics include several sample scripts. You can click on the topic title to jump to the topic to view the sample code.
Example: Building an Animation Connection through a Script
Example: Script Using ParseConnectionSource Method
Example: Script Using GetConnectionInformation Method with IsConnected Method
Example: Script Using the GetPropertyAttributes Method
Example: Script Using CanConstruct Method
Example: Script Using Construct Method
Example: Script Using ValidateSource Method
Animation Properties and Methods
Example: Using Range Comparison
Example: Using Exact Match Lookup
Example: Animating the Rotation of an Object
Example: Rotating a Group Using a Script
Example: Creating a Toolbar
Example: Using an Alias to Open and Close Displays
Example: Using the ReplacePicture Subroutine
Example: Group Write
Example: Group Read
Example: Writes to Alternate Sources
Example: Using the Database Tag's Value Property
Working in the Run-time Environment
Example: Changing the Data Source of an Animation Connected to an Object
Example: Form Code
Example: Module Code
Example: DeltaV Operate Object Code
Working with the Scheduler and the DoEvents Function
Example: Checking Disk Space and Triggering an Alarm if Too Low
Example: Recording DownTime Monitoring
Example: Using GetPenDataArray to Extract Data from Pen
Example: SetPenDataArray Method with Hardcoded Values
The Automation Interfaces help file has an example for each method in the system, and the VBA Help file contains an entire section devoted to nothing but sample code.
You can also look at the Visual Basic source code for all DeltaV Operate toolbars and Experts. To do so:
Open a new picture in DeltaV Operate.
Select the Toolbars command from the WorkSpace menu and select each toolbar in the Toolbars list box. Click the Close button.
Select the Visual Basic Editor command from the WorkSpace menu.
In the VBE, select the Project Explorer command from the View menu.
In the Project Explorer, click the plus sign (+) next to any of the available projects to show the contents of the project.
Double-click a form or module within the project to display it in the VBE. For example, if you expand the Project_Experts project, expand its Forms folder, and double-click the frmFill form to view the Fill Expert form.