Sep-05 Slide:1 ActiveX Controls in VB ActiveX Controls in VB6.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Advertisements

Chapter 1: An Introduction to Visual Basic 2012
Using Macros and Visual Basic for Applications (VBA) with Excel
Microsoft® Small Basic
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
VB Controls and Events Week 7: Picture Box, Image Box, Option, Check box, Mouse over, Frames, Shapes.
Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second.
Compunet Corporation Programming with Visual Basic.NET GUI Week # 11 Tariq Ibn Aziz.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Controls General Discussion. VB Controls Visual Basic Controls A control is the generic name for any object placed on a form Controls may be images,
3/9/2004 PPCC - Introduction to VB6 Copyright ©2004, Tore Bostrup 1 Introduction to VB6 Week 2.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
Lab 9 – User Forms Design. User Forms What are user forms? –Known as dialog boxes –Major ways for getting user input An example of using user forms: Monthly.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Multiple Forms and Standard Modules
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
IE 411/511: Visual Programming for Industrial Applications
BIM211 – Visual Programming Objects, Collections, and Events 1.
Let’s get started using Visual Basic!. Private Sub cmdGo_Click... Dim strMessage As String Dim sngSum As Single If IsNumeric(txtNumber1.Text) = False.
‘Tirgul’ # 7 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #7.
Review for Mid-term! October 26, Review Homework Worksheet True or False Operators are symbols that perform specific operations in Visual Basic.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Irwin/McGraw-Hill © The McGraw-Hill Companies, Inc., Visual Basic Projects Project Structure and VB’s Programming Tools chapter TWO.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
BIL528 – Bilgisayar Programlama II Introduction 1.
Chapter Two Creating a First Project in Visual Basic.
Chapter 3: Creating ActiveX Controls By Noppadon Kamolvilassatian Dept. of Computer Engineering, Prince of Songkla University Source: Mastering Visual.
Controls. Adding Controls to Form -You can pick controls from the toolbox. -To add the controls from Toolbox to the Form You have be in design view. -To.
Chapter 2 – Introduction to the Visual Studio .NET IDE
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
CS130 Project 1 A simple VB application ("project" or program): user enters amount of sales then clicks the "Calculate button", the application displays.
MS Visual Basic 6 Walter Milner. VB 6 0 Introduction –background to VB, A hello World program 1 Core language 1 –Projects, data types, variables, forms,
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
1 Advanced Computer Programming Lab Calculator Project.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
1 Visual Basic Part I - A tool for customizing your program Principles of GIS
VAT Calculator program Controls Properties Code Results.
Forms and Controls Part 3 dbg --- Naming conventions, Button, Event handlers, Label.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
VB 4 Controls Scrollbar Radio button check box listboxes timers control arrays.
Forms and Controls Part 3 dbg --- Naming conventions, Button, Event handlers, Label.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
Sorry, the pen lost control. Anyway, you need to download both the.vbp and the.frm for each project. I looked at PrCalc, I did not look at inventory.
More Visual Basic!. Creating a Standalone Program A standalone program will allow you to make a program file that can be run like other Windows programs,
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
PaintPictureBoxDemo Refers to the PaintPictureBoxDemo Visual Basic Program Included With The Lecture.
CS 281 – Fall 2010 Lab 4 Parametric Query and Forms in MS Access.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Problem: Take Two Numbers, Add Them Together And Display The Results. Now To Build The Flowchart… We Probably Need One Like This… Let’s Add The Routines…
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
Chapter 1: An Introduction to Visual Basic 2015
Chapter 2 – Introduction to the Visual Studio .NET IDE
1. Introduction to Visual Basic
Introduction to VB6 Week 1 3/2/2004 PPCC - Introduction to VB6
Dr. Ralph D. Westfall June, 2011
Windows Desktop Applications
Visual Basic..
Simple Windows Applications
Presentation transcript:

Sep-05 Slide:1 ActiveX Controls in VB ActiveX Controls in VB6

Sep-05 Slide:2 ActiveX Controls in VB What are ActiveX Controls? Custom UI Controls Which you can design and add to the toolbox And then use in applications

Sep-05 Slide:3 ActiveX Controls in VB Creating Simple ActiveX Controls Start with New Project.. ActiveX Control Design/program as if a form Add a project to Group – test it in that Finally, produce a compiled OCX file For example, a simple clock control..

Sep-05 Slide:4 ActiveX Controls in VB The Clock Control 1

Sep-05 Slide:5 ActiveX Controls in VB Clock Control 2 It will work by having a Timer Which ticks every second And gets system time And displays it in a label

Sep-05 Slide:6 ActiveX Controls in VB Clock Control 3

Sep-05 Slide:7 ActiveX Controls in VB Clcok Control 4 - Testing

Sep-05 Slide:8 ActiveX Controls in VB Clock Control 5 – Normal exe project added

Sep-05 Slide:9 ActiveX Controls in VB Clock Control 6 – Set Test as Startup Or when you Run it it will start in a browser

Sep-05 Slide:10 ActiveX Controls in VB Clock Control 7 – The control in use

Sep-05 Slide:11 ActiveX Controls in VB Clock control 7 – Give it a name

Sep-05 Slide:12 ActiveX Controls in VB Clock Control 8 – Make.ocx file

Sep-05 Slide:13 ActiveX Controls in VB Clock Control 8 – Adding Control in a new project

Sep-05 Slide:14 ActiveX Controls in VB ActiveX Exercise 1 Make a Clock control like this but.. Have 3 fields showing hour, minute and second Use hour() minute() and second() functions

Sep-05 Slide:15 ActiveX Controls in VB Controls with properties Most controls have properties used for design Example background colour of textbox And properties for user input Such as text in a text box ActiveX usually need the same

Sep-05 Slide:16 ActiveX Controls in VB ActiveX Controls are like Classes (as are forms) They have methods They have private data members They have property let and get routines Can set up events

Sep-05 Slide:17 ActiveX Controls in VB Two 'users' of custom controls One user is the programmer who uses the control in a form design The other is the final end-user who uses that form You have to write code for both types of user

Sep-05 Slide:18 ActiveX Controls in VB Properties modified at design-time Need public property Let and Get and private data member for internal representation But property values differ between control instances and must 'persist' when Form not in memory so must be written to disc somehow actually stored in the.frm file this persistence is not automated

Sep-05 Slide:19 ActiveX Controls in VB Example – a spinner control Input integer values Buttons to increase/decrease value Need a StepSize property

Sep-05 Slide:20 ActiveX Controls in VB End-user code Private Sub Command1_Click() Text1.Text = CInt(Text1.Text) + StepSize End Sub Private Sub Command2_Click() Text1.Text = CInt(Text1.Text) - StepSize End Sub

Sep-05 Slide:21 ActiveX Controls in VB Dim ssize As Integer Public Property Let StepSize(val As Integer) ssize = val PropertyChanged "StepSize" End Property Public Property Get StepSize() As Integer StepSize = ssize End Property Private Sub UserControl_WriteProperties(PropBag As PropertyBag) PropBag.WriteProperty "StepSize", StepSize, 0 End Sub Private Sub UserControl_ReadProperties(PropBag As PropertyBag) StepSize = PropBag.ReadProperty("StepSize", 0) End Sub Private Sub UserControl_Initialize() Text1.Text = 0 End Sub Designer-user code

Sep-05 Slide:22 ActiveX Controls in VB Designer use

Sep-05 Slide:23 ActiveX Controls in VB.FRM contents VERSION 5.00 Object = "*\AspinnerProject.vbp" Begin VB.Form Form1.. ScaleWidth = 4680 StartUpPosition = 3 'Windows Default Begin Project1.UserControl1 UserControl12 Height = 855 Left = _ExtentY = 1508 StepSize = 9 End Begin Project1.UserControl1 UserControl11 Height = _ExtentY = 873 StepSize = 5 End..

Sep-05 Slide:24 ActiveX Controls in VB ActiveX Exercise 2 Write a 'slider' control for numeric input When user drags mouse from area, input is mouse Y Have textbox and pictureBox Program the mouseMove event of the PictureBox, use the Y parameter Once working.. add a scale property set at design-time Then expose a 'Value' property which allows access to the number in the (Let and Get) and read/write

Sep-05 Slide:25 ActiveX Controls in VB Adding Events to controls A control can make an event occur This would be a 'custom' event for the control Designer can then program an event-handler for it For example, in the spinner control, could hav ea BadKey event if non-digit key pressed..

Sep-05 Slide:26 ActiveX Controls in VB Control with Event.. Public Event Badkey().. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Or KeyCode = 8 Then Exit Sub 'Enter or backspace If KeyCode 57 Then ' not 0 to 9 RaiseEvent Badkey End If End Sub

Sep-05 Slide:27 ActiveX Controls in VB Designer writes event-handler

Sep-05 Slide:28 ActiveX Controls in VB ActiveX Control Exercise 3 Add a 2Click event to the slider control Triggered when picturebox double-clicked As designer, use it to zero the value