Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code

Similar documents
Programming with visual Basic:

FIT 100. Lab 8: Writing and Running Your First Visual Basic Program Spring 2002

Visual C# Program: Temperature Conversion Program

Document Editor Basics

The Control Properties

Visual Basic 6 Lecture 7. The List Box:

Visual C# Program: Resistor Sizing Calculator

Creating a Flyer. Open Microsoft Publisher. You will see the list of Popular Publication Types. Click the Blank Page Sizes.

Start Visual Basic. Session 1. The User Interface Form (I/II) The Visual Basic Programming Environment. The Tool Box (I/II)

Forms for Android Version Manual. Revision Date 12/7/2013. HanDBase is a Registered Trademark of DDH Software, Inc.

2-26 Learn Visual Basic 6.0

An Animated Scene. Pick a color for the street. Then use the Paint can to fill the lower part of the page with grass.

Grade: 7 Lesson name: Creating a School News Letter Microsoft Word 2007

Table of Contents. iii

PROGRAMMING LANGUAGE 2 (SPM3112) NOOR AZEAN ATAN MULTIMEDIA EDUCATIONAL DEPARTMENT UNIVERSITI TEKNOLOGI MALAYSIA

University of Technology Laser & Optoelectronics Engineering Department Visual basic Lab. LostFocus Resize System event

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA IN INFORMATION TECHNOLOGY Semester: 4

Dive Into Visual C# 2008 Express

Access Forms Masterclass 5 Create Dynamic Titles for Your Forms

Developing Motion Systems in Measurement Studio for Visual Basic

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points

Tutorials. Lesson 3 Work with Text

VBA Foundations, Part 7

Band Editor User Guide Version 1.3 Last Updated 9/19/07

Visual C# Program: Simple Game 3

Forms Desktop for Windows Version 4 Manual

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports

M-Password Application Actions

KaleidaGraph Quick Start Guide

17. Introduction to Visual Basic Programming

(0,0) (600, 400) CS109. PictureBox and Timer Controls

Step 5: Figures and Tables

Computer Science 110. NOTES: module 8

Introductionto the Visual Basic Express 2008 IDE

Adding Objects Creating Shapes Adding. Text Printing and Exporting Getting Started Creating a. Creating Shapes Adding Text Printing and Exporting

Tutorial 03 understanding controls : buttons, text boxes

NiceForm User Guide. English Edition. Rev Euro Plus d.o.o. & Niceware International LLC All rights reserved.

Using Microsoft Excel

Angel International School - Manipay 1 st Term Examination November, 2015

2Practicals Visual Basic 6.0

MICROSOFT POWERPOINT BASIC WORKBOOK. Empower and invest in yourself

TSM Report Designer. Even Microsoft Excel s Data Import add-in can be used to extract TSM information into an Excel spread sheet for reporting.

Upgrading Applications

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

Create a custom tab using Visual Basic

NATIONAL DIPLOMA IN COMPUTER TECHNOLOGY

Display Systems International Software Demo Instructions

TITLE: GLASS GOBLET. Software: Serif DrawPlus X8. Author: Sandra Jewry. Website: Draw Plus Tutorials by San. Skill Level: Beginner.

Forms for Palm OS Version 4 Manual

19. VB Project and Menu Design

Unit 11.Introduction to Form and Report

Windows Application Development Tutorial for ASNA Visual RPG 8.0 for Microsoft Visual Studio.NET 2005

Angel International School - Manipay 1 st Term Examination November, 2015

Full file at

Your comments and suggestions on the operation of this software are welcome. Please address them to:

Visual Basic. The Integrated Development Environment. Menu Bar

EZware Quick Start Guide

Disclaimer. Trademarks. Liability

TRAINING GUIDE FOR OPC SYSTEMS.NET. Simple steps to successful development and deployment. Step by Step Guide

Paint Tutorial (Project #14a)

Exercise 1: Introduction to MapInfo

NOTES: Variables & Constants (module 10)

Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson

Human Factors Engineering Short Course Topic: A Simple Numeric Entry Keypad

LinkMotion and CorelDraw 9, 10, 11, 12, X3, X4, X5, X6, X7 and X8:

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

DataViews for Windows Version 2.0

C H A P T E R T W E N T Y E I G H T. Create, close, and open a Web application. Add an image, text box, label, and button to a Web page

BIM - ARCHITECTUAL PLAN VIEWPORTS

The Fundamentals. Document Basics

CREATING A CUSTOM SMART TITLE BLOCK

SMART Recorder. Record. Pause. Stop

Your comments and suggestions on the operation of this software are welcome. Please address them to:

Using Visual Basic Studio 2008

REVIEW OF CHAPTER 1 1

9 Using Appearance Attributes, Styles, and Effects

Inspire Ten Minute Task #1

Designer Reference 1

Chapter 2 Visual Basic, Controls, and Events. 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual Basic Events

Unit 9 Spreadsheet development. Create a user form

Let s Make a Front Panel using FrontCAD

2-18 Learn Visual Basic 6.0

Your comments and suggestions on the operation of this software are welcome. Please address them to:

Poster-making 101 for 1 PowerPoint slide

You can also search online templates which can be picked based on background themes or based on content needs. Page eleven will explain more.

Las Vegas, Nevada, December 3 6, Kevin Vandecar. Speaker Name:

GIMP TEXT EFFECTS. Text Effects: Outline Completed Project

FRC LabVIEW Sub vi Example

Chapter 2. Creating Applications with Visual Basic Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of

James Foxall. Sams Teach Yourself. Visual Basic 2012 *24. Hours. sams. 800 East 96th Street, Indianapolis, Indiana, USA

POWERPOINT 2003 OVERVIEW DISCLAIMER:

SYLLABUS B.Com (Computer) VI SEM Subject Visual Basic Unit I

28 Simply Confirming On-site Status

WallSign TASKE Call Center Management Tools Version 7.0. Table of Contents TABLE OF CONTENTS TASKE WallSign Startup and Shutdown...

Contents. More Controls 51. Visual Basic 1. Introduction to. xiii. Modify the Project 30. Print the Project Documentation 35

Overview About KBasic

CREATING A POWERPOINT PRESENTATION BASIC INSTRUCTIONS

Adobe PageMaker Tutorial

The Newsletter will contain a Title for the newsletter, a regular border, columns, Page numbers, Header and Footer and two images.

Transcription:

Your comments and suggestions on the operation of this software are welcome. Please address them to: ICONICS 100 Foxborough Blvd. Foxborough, MA 02035 Tel: 508-543-8600 Fax: 508-543-1503 E-mail: support@iconics.com Web: www.iconics.com ICONICS, Inc. All rights reserved. Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code ICONICS 1

Introduction This example describes how to integrate the Alarm Logger when programming in Microsoft Visual Basic (VB). The example shows how to build a form to enable logging and printing. ICONICS 2

Getting Started 1. Open a new Standard EXE project in Visual Basic. This opens a new blank Visual Basic form. 2. Before adding anything to this form, you must add the AlarmWorX32 Viewer ActiveX component to your toolbox. To do this, right-click anywhere in the toolbox and select Component from the pop-up menu. This opens the Components dialog box, as shown in the figure below. Select AWXVIEW32 ActiveX and click OK. 3. You are now ready to begin configuring the interface for the new Visual Basic form. Components Dialog ICONICS 3

Visual Basic Form Configuration Click the Label button in the toolbox and draw two rectangles on the blank VB form that you created earlier. Your form should now look like the figure below. VB Form With Two Labels These labels will be referenced in later code so that, while the program is running, the date will be displayed on the field Label1, and the time will be displayed on the field Label2. You must now insert a timer object over the Label2 field. Click the Timer button in the toolbox and draw a square over the Label2 field. The timer will appear in the form. Next add a shape where the action buttons will be located. Click the Shape button in the toolbox and insert the shape on the form so that your form looks like the one in the figure below. ICONICS 4

VB Form With Shape and Timer To configure the shape, select it and then enter the following data in the Properties window. (Name): BackColor: BackStyle: BorderColor: BorderStyle: Shape1 Clicking the down opens a palette. Select a light color for the back color. 1 - Opaque Choose something dark that will contrast with the Back Color you picked. 6 - Inside Solid BorderWidth: 1 DrawMode: FillColor: FillStyle: Shape: 13 - Copy Pen Choose the same color as the Back Color 1 - Transparent 4 - Rounded Rectangle Now you will add the action buttons and text fields on top of the shape. Click the CommandButton button in the toolbox and insert two buttons over the shape that you have just configured. Your form should look like the one in the figure below. ICONICS 5

VB Form With Command Buttons To configure each button, select it and then enter the following data in the Properties window. (Name) CmdEnableAlarms CmdEnablePrinting Appearance: 1-3D 1-3D Caption: &Enable Logging E&nable Printing Note: To successfully enable printing, it is necessary to configure a printer in the AlarmWorX32 Logger. Click the TextBox button in the toolbox and insert two textboxes (one after each button). These text boxes will indicate whether logging and printing are enabled. To configure each textbox, insert the following data in the properties window: (Name): TxtEnableLog TxtPrinting Alignment: 0 - Left Justify 0 - Left Justify Appearance: 1-3D 1-3D BorderStyle: 1 - Fixed Solid 1 - Fixed Solid Font: MS Sans Serif - 12pt MS Sans Serif - 12pt Text: OFF OFF Your form should look like the one in the figure below. ICONICS 6

VB Form With Text Boxes The final button you will add is the Exit button, which will effectively exit the user out of this form. Click the CommandButton button in the toolbox and insert a button underneath the previously inserted shape. To configure the button, enter the following data in the properties window: (Name): Appearance: Caption: ComExit 1-3D E&xit For the purposes of appearance and grouping, we will add a label component that will enclose all of the components that were just added. Click the Label button in the toolbox and insert the label so your form looks like the one in the figure below. ICONICS 7

VB Form With Exit Button To configure the label, select it and then enter the following data in the Properties window. Label3 Alignment Appearance Back Style BorderStyle 0 - Left Justify 1-3D 1 - Opaque 1 - Fixed Single Now it is time to enter the code behind the components! ICONICS 8

Entering the VB Code To enter the code behind a component, double-click on the component. This opens the Project - Form (Code) window. Before you enter code for any of the components, enter the following definitions by double-clicking on the form itself: Dim b_loggingenabled As Boolean Dim b_printingenabled As Boolean Dim Logger As New AWXLog32Auto It is important to enter these definitions because they are referenced in later code. 1. The first component for which you will enter the code is the Enable Logging button. When selected, this button will turn on or off alarm logging. Double-click the Enable Logging button and enter the following code: Private Sub CmdEnabelAlarms_Click() 'will Enablel/Disable AlarmLogger. On Error GoTo INIT_ERR If b_loggingenabled = False Then 'if its off then swich it on b_loggingenabled = True TxtEnableLog.Text = "ON" Logger.LoggingEnabled = b_loggingenabled Else 'or, its on then swich it off TxtEnableLog.Text = "OFF" b_loggingenabled = False Logger.LoggingEnabled = b_loggingenabled End If Exit Sub ' INIT_ERR: If Err = -2147467259 Then ' AlarmLogger is not Loaded yet then just waite WaitToLoadAlarmLogger CmdEnabelAlarms_Click End If Private Sub WaitToLoadAlarmLogger() 'this function will pause the time for The PauseTime in seconds. ICONICS 9

Dim Start ', count PauseTime = 5 'count = 0 Start = Timer ' Set start time. Do While Timer < Start + PauseTime DoEvents ' Yield to other processes. 'count = Timer - Start Loop 2. The next component for which you will enter code is the Enable Printing button. When selected, this button will enable or disable printing. Double-click the Enable Printing button and enter the following code: Private Sub CmdEnablePrinting_Click() 'will Enable/Disable printing the Alarms. On Error GoTo INIT_ERR If b_printingenabled = False Then 'if its off then swich it on b_printingenabled = True TxtPrinting.Text = "ON" Logger.PrintingEnabled = b_printingenabled Else TxtPrinting.Text = "OFF" 'or, its on then swich it off b_printingenabled = False Logger.PrintingEnabled = b_printingenabled End If Exit Sub ' INIT_ERR: If Err = -2147467259 Then ' AlarmLogger is not Loaded yet then just wait WaitToLoadAlarmLogger CmdEnablePrinting_Click End If 3. Next you will enter the code for the Exit button. When selected, this button will exit the user out of the form. Double-click the Exit button and enter the following code: Private Sub ComExit_Click() ICONICS 10

Unload Me 4. Next you will enter the code for the entire form. Double-click the form and enter the following code: Private Sub Form_Initialize() b_printingenabled = False 'set the Alarm Printing to OFF. Private Sub Form_Load() Dim MyDate, MyTime Dim ob As Object Timer1.Interval = 1000 ' Set Timer interval for every second. MyDate = Format(Date, "dddd, mmm d yyyy") 'set the DATE format. Label1.Caption = MyDate ' load the current date. Screen.MousePointer = vbhourglass On Error GoTo INIT_ERR If Logger.LoggingEnabled = False Then 'if its off then show it OFF in the TxtEnableLog TxtEnableLog.Text = "OFF" Else 'or, its ON then show it OFF in the TxtEnableLog TxtEnableLog.Text = "ON" End If Screen.MousePointer = VBDEFULT Exit Sub ' INIT_ERR: If Err = -2147467259 Then ' AlarmLogger is not Loaded yet then just waite WaitToLoadAlarmLogger Form_Load End If Private Sub Form_Unload(Cancel As Integer) Set Logger = Nothing ' kill the Object Logger. ICONICS 11

5. Now you will enter the code for the Timer function. Double-click the Timer button and enter the following code: Private Sub Timer1_Timer() 'just to update the Clock at every second. Label2.Caption = Time 'Load the current time. 6. Once you have entered all of the above code, you must save and compile your project. Select Save As from the File menu and save the project as VBAlarmTest.exe. To compile the project, select Make VBAlarmTest.exe from the File menu. ICONICS 12