CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.

Slides:



Advertisements
Similar presentations
Customizing the MOSS 2007 Search Results November 2007 Rafael Perez.
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Microsoft Office 2007: Introductory Computer Applications 11.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Michael Donovan, River Campus Libraries – 12/03 DocuShare Overview and Training.
Using Visual Basic 6.0 to Create Web-Based Database Applications
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Using the Visual Basic Editor Visual Basic for Applications 1.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Images: HTML and CSS. The Bells page without images in Source View and Design View.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Sep-05 Slide:1 ActiveX Controls in VB ActiveX Controls in VB6.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Introduction to Visual Basic (VB)
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
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.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
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
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
‘Tirgul’ # 7 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #7.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Key Applications Module Lesson 21 — Access Essentials
CIS 338: Using Queries in Access as a RecordSource Dr. Ralph D. Westfall May, 2011.
Chapter Two Creating a First Project in Visual Basic.
CSD 340 (Blum)1 Using Visual Studio CSD 340 (Blum)2 Start/Microsoft Visual Studio 2005/Microsoft Visual Studio 2005.
Introduction to Microsoft publisher
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.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
CIS 338: Events Dr. Ralph D. Westfall April, 2011.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
CIS 338: VB.NET Printing Dr. Ralph D. Westfall May, 2011.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Computing and Information Technology Building a Web Browser
Objectives Create a folder in Google Drive.
Chapter 2: The Visual Studio .NET Development Environment
Integrating Office 2003 Applications and the World Wide Web
Getting Started with Application Software
Microsoft Visual Basic 2005 BASICS
Using PowerPoint to Scaffold a Text
Chapter 2 – Introduction to the Visual Studio .NET IDE
3.01 Apply Controls Associated With Visual Studio Form
1. Introduction to Visual Basic
3.01 Apply Controls Associated With Visual Studio Form
Access Project 8 Using Visual Basic for Applications (VBA) and Creating Multi-Page Forms.
Microsoft Office Access 2003
Microsoft Office Access 2003
Chapter 2 – Introduction to the Visual Studio .NET IDE
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003

ActiveX Background important part of Microsoft's DNA Distributed interNet Applications software components delivered from network where and when needed COM (component object model) makes it possible for individual components to work together

ActiveX Includes scripting on client, or on server (ASP) controls – used locally or in web pages ActiveX documents – browser can show Office files: Word, Excel, etc. ADO – provides way to get data server components – interface IIS to other data sources

What Are ActiveX Controls? like other VB controls: text box, list box, data control, etc. may be created by third parties, rather than Microsoftthird parties other software companies individual programmers: people like you  you could sell through third party vendorsvendors

How Create ActiveX Controls? hook together existing VB controls added code makes them work together modify existing VB controls added code changes their behavior create a user-drawn control VB graphics methods create appearance added code provides desired behavior combinations of above

Combining Existing Controls get all existing functionality "inherit" properties and methods handled as a single unit by code users understand it easily based on previous experiences with individual components built into the control

Example: Address Control File>New Project>ActiveX Control change project and control names add textboxes and labels not too far apart add appropriate Name properties click and drag corners to size the form sets Height and Width properties

Address Control - 2 add some code Resize event – pp 'Notes With UserControl 'connect it to 'items with dots Property procedure – p. 310'Notes s = s & txtStreet & vbCrLf 'appends string with Cr and Lf 'to previous string

Testing Address Control create another project to test it File>Add Project>Standard EXE note new icon on Toolbox close UserControl window may need to use Window menu to close draw this control on the new form test code by resizing the control

Testing Address Control - 2 set the standard EXE as startup project right click Project 2 in Project Explorer note boldface on startup project add Command button and code Print UserControl11.AddressText 'might help to check/copy control 'name on Form1 Properties Window run project'Notes

Testing in Browser some ActiveX controls designed for use in web pages on Internet inside organizations/Intranets if using on the web, need to test in a browser set the ActiveX Control project (Project1.vbp) as the StartUp, then run

Compiling Open ActiveX control project (not group) File>Make [file].ocx save the.ocx file somewhere it will be easy to find e.g., in a new folder among your Visual Studio>Visual Basic files unload control project

Testing Compiled Control start a standard EXE add your new ocx to Toolbox with Project> Components> Browse> OK use new icon on toolbox to add to form change StartUp Project to Project 2 (the new Standard EXE) add a button and some code for it run project

Enhancing an Existing Control alternative to adding same code for desired behavior in multiple projects build code into a custom control instead can add properties, methods, events to a control's existing functionality e.g., add things to a textbox or button

Creating an Enhanced Control File>New Project>ActiveX Control make project name = TextP right click Project 1>Properties>Project Name and change it view Properties Window, change (Name) to something different e.g., TextP1 add textbox to upper left corner of form reduce form width/height to textbox size

Adding New Behavior add a resize event to UserControl Private Sub UserControl_Resize() Text1.Height = UserControl.ScaleHeight Text1.Width = UserControl.ScaleWidth End Sub add code for capitalization behavior Private Sub Text1_LostFocus() Text1 = StrConv(Text1, vbProperCase) End Sub'Notes

Compiling File>Make [file].ocx save the.ocx file somewhere it will be easy to find e.g., in a new folder among your Visual Studio>Visual Basic files remove ActiveX control project

Testing Enhanced Control create a new project to test it File>New Project>Standard EXE add your new ocx to Toolbox with Project> Components> Browse> OK click/drag new control onto form for every input that needs to have first letter capitalized (on all words) add regular textboxes otherwise

Testing / Compiling test new form be sure the new Project is the StartUp form if haven't done so already, re-open ActiveX control and compile it for use in other projects save the.ocx file in a new folder e.g., among your Visual Studio>Visual Basic files

Control Interface Wizard comes with VB, automates some of code creation for custom controls Add-Ins>Add-In Manager>Visual Component Manager 6.0 needs to say Startup/Loaded on right side  may need to double click it to get it right

Control Interface Wizard - 2 File>New Project>ActiveX Control draw textbox on top left corner of form reduce form size to size of textbox delete Text1 from Text property click UserControl set UserControl.Name=txtCharLimit make sure Public=True (usual default)

Control Interface Wizard - 3 Project>Add User Control>VB ActiveX Control Interface Wizard, Next select, add (>) Text property, Next New CharAccept (Property) OK New UserError (Event) OK, Next

Control Interface Wizard - 4 Set Mapping (Public Name) click Text (on left) (Control) click txtCharLimit (on right) (Member) Text (on right) Next

Control Interface Wizard - 5 Set Attributes Public Name = CharAccept Data Type = Integer Default Value = 0 Description = [programmer comments] Next, Finish look at Summary (To Do list)

Control Interface Wizard - 6 view code note warnings not to delete comments used by code generator to work with code the next time if don't delete comments, can still use Control Wizard after adding programmer written code to generated code

Control Interface Wizard - 7 add Limited.Zip code (pp or ISBN= ) replace code for Let CharAccept add code for txtCharSet_KeyPress in copied code, need to change every mCharAccept to m_CharAccept create standard EXE, add control, run standard EXE needs to be start up object change CharAccept property of control 1, 2

THE END following slides have not been completed yet

Property Pages Wizard also comes with VB, automates setting properties for custom controls unload previous standard EXE 1 st way to start Project>References>VB Property Page Wizard>OK Project>Add Property Page>VB Property Page Wizard>Open

Property Pages Wizard - 2 other way to start Add-Ins>Add-In Manager>VB 6 Property Page Wizard>OK needs to say Loaded: may need to double click to get it right Add-Ins>Property Page Wizard>Next

Property Pages Wizard - 3 Add-Ins>ActiveX Property Page Wizard, Next click Add, rename new page as General, OK, Next select CharAccept, Next, Finish

Property Pages Wizard - 3 create standard EXE, add this control click on control click Custom in Properties Window click General tab set CharAccept = 1 (or 2) run