SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI)


                                                     Chapter 6
                                                   Multiple Forms


Adding Form to a Project
Steps for adding a form to a project:
        1. Select Project Menu from VB6 Menu bar.
        2. Choose Add Form.
        3. Select Form from the Add Form Dialog Box.




---------------------------------------------------------------------------------------------------------------------------
-----------

The Hide and Show Methods
Display a form with a Show method and conceal a form with the Hide Method.

Show Method
      General form - FormName.Show [Style]
      The optional style determines whether the form will display modeless or modal.
       The values for Style can be 0-modeless and 1-modal, default is 0. You can also use VB
      intrinsic constants; vbModal and vbModeless.

     When the form is displayed as modal, the user must respond to the form in some way.
     No other code can execute until the modal form has been responded to and hidden or
     unloaded.
     If the form is displayed as modeless, the user may switch to another form.
Examples frmMain.Show 1
        frmMain.Show vbModal
        frmMain.Show vbModeless
        frmMain.Show

Hide Method
      General Form – FormName.Hide
      Hide method is used to remove a form from the screen.
Example – frmMain.Hide

---------------------------------------------------------------------------------------------------------------------------

Form_Load and Form_Activate
The first time a form is displayed in a project, VB generates two events—a Form_Load and
Form_Activate.
The Form_Load event calls the form module into memory.

                                                                                                                          1
VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI)


The Form_Activate event occurs after the Form_Load event, just as control is passed to the
Form. Each time the form is shown the Form_Activate event occurs and not the Form_Load
event.

---------------------------------------------------------------------------------------------------------------------------

Me Keyword
The current form can be referred by using the special Keyword Me.
Me acts like a variable and refers to the current active form.
Use Me in place of Form name when coding form statements and methods.
       Example: Unload Me
                  Me.Hide

---------------------------------------------------------------------------------------------------------------------------

Load and Unload Statements
Load – When you show a form, the Load is done automatically.
       The only time you will code a Load statement is when you want to load a form but not
       display.
General Form – Load FormName
Example: Load frmLogIn

Unload –To remove a form from the screen, hide it unload it.
         Hiding a form removes it from the screen, but the form still remains in the memory.
         If you do not need the form for further execution, the best way is to unload the form.
General form – Unload FormName
Example: Unload frmLogin

---------------------------------------------------------------------------------------------------------------------------

Example of SHOW/ HIDE and LOAD /UNLOAD




Standard Code Module
A Standard Code Module is a basic procedure with the extension .bas which is added to the
project.
Standard code module does not contain Form Window. It only contain a Code window. A
standard code module has general declaration section and procedure just like form module.


                                                                                                                          2
VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI)


They can contain global (available to the whole application) or module-level declarations of
variables, constants, types, external procedures, and global procedures.

Standard Code Module is visible to all procedures in the module but not to procedure in
the form module.
Adding a Standard Code Module to Project
Steps for adding a Standard Code Module to a project:
        1. Select Project Menu from VB6 Menu bar.
        2. Choose Add Module.
        3. Select Module from the Add Module Dialog Box.




---------------------------------------------------------------------------------------------------------------------------

Global/ Public Variables
If you want variables and constants to be accessible to more than one form in the project, they
must be global variables. To declare global variables, use the Public statement in place of the
Dim statement.
General form – Public Identifier [As Datatype]
               Public Const Identifier [As Datatype] = Value
        A public variable or constant has a prefix of g.

Static Variables
Static variables retain their value for the life of the project, rather than being initialized for each
call to a procedure. If you need to retain the value in a variable for multiple calls to a procedure,
such as a running total, declare it as Static.
General form – Static Identifier [As DataType]
 Static statements can appear only in procedures; Static statements never appear in the General
Declarations section of a module. Static variables do not require a scope prefix, since all static
variables are local.
---------------------------------------------------------------------------------------------------------------------------

Setting the Startup Form
By default, the first form in your application is designated as the startup form. When your
application starts running, this form is displayed.
If you want a different form to display when your application starts, you must change the
startup form.
To change the startup form
          1. From the Project menu, choose Project Properties.
          2. Choose the General tab.
          3. In the Startup Object list box, select the form you want as the new startup form.
          4. Choose OK.
---------------------------------------------------------------------------------------------------------------------------

                                                                                                                          3
VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI)


Starting Without a Startup Form : SUB MAIN()
Sometimes you might want your application to start without any form initially loaded.
For example, you might want to execute code that loads a data file and then displays one of
several different forms depending on what is in the data file.
You can do this by creating a Sub procedure called Main in a standard module, as in the
following example:
          Sub Main()
                    frmSplash.Show vbModeless
                    Load frmMain
          End Sub
This procedure must be a Sub procedure, and it cannot be in a form module.
To set the Sub Main procedure as the startup object, from the Project menu, choose Project
Properties, select the General tab, and select Sub Main from the Startup Object box.
---------------------------------------------------------------------------------------------------------------------------

Displaying a Splash Screen on Startup
If you need to execute a lengthy procedure on startup, such as loading a large amount of data
from a database or loading several large bitmaps, you might want to display a splash screen on
startup.

A splash screen is a form, usually displaying information such as the name of the application,
copyright information, and a simple bitmap. The screen that is displayed when you start Visual
Basic is a splash screen.
To display a splash screen, use a Sub Main procedure as your startup object and use the Show
method to display the form:
        Private Sub Main()
                  ' Show the splash screen.
                   frmSplash.Show
                   ' Add your startup procedures here.
                   

                   ' Show the main form and unload the splash screen.
                   frmMain.Show
                   Unload frmSplash
        End Sub

The splash screen occupies the user's attention while your startup routines are executing, giving
the illusion that the application is loading faster. When the startup routines are completed, you
can load your first form and unload the splash screen.

Adding a Splash Screen to Project
Steps for Adding a Splash Screen to Project:
        1. Select Project Menu from VB6 Menu bar.
        2. Choose Add Form.
        3. Select Splash Screen from the Add Form Dialog Box.




                                                                                                                          4
VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI)




---------------------------------------------------------------------------------------------------------------------------

Displaying a About Box

Adding an About Box to Project
Steps for Adding a About Box to Project:
        1. Select Project Menu from VB6 Menu bar.
        2. Choose Add Form.
        3. Select About Box from the Add Form Dialog Box.

About Box contains the Application Title, Version, and App Description placeholders with
information specific to your application.




                                                                                                                          5

Weitere Àhnliche Inhalte

Was ist angesagt?

Ms vb
Ms vbMs vb
Ms vbsirjade4
 
Controls events
Controls eventsControls events
Controls eventsDalwin INDIA
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesSami Mut
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010Ali Mattash
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingAbha Damani
 
Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Salim M
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 introJOSEPHINEA6
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training Moutasm Tamimi
 
Visual Programming
Visual ProgrammingVisual Programming
Visual ProgrammingBagzzz
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture AqsaHayat3
 
Best practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.netBest practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.netajmal_fuuast
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm ProgramsHock Leng PUAH
 
Introduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsIntroduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsSanay Kumar
 
User define data type In Visual Basic
User define data type In Visual Basic User define data type In Visual Basic
User define data type In Visual Basic Shubham Dwivedi
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)Bilal Amjad
 

Was ist angesagt? (19)

Ms vb
Ms vbMs vb
Ms vb
 
Controls events
Controls eventsControls events
Controls events
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
 
Visual C# 2010
Visual C# 2010Visual C# 2010
Visual C# 2010
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
 
Visual programming
Visual programmingVisual programming
Visual programming
 
Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0Basic controls of Visual Basic 6.0
Basic controls of Visual Basic 6.0
 
Visual basic
Visual basicVisual basic
Visual basic
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
 
4.C#
4.C#4.C#
4.C#
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
 
Best practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.netBest practices for upgrading vb 6.0 projects to vb.net
Best practices for upgrading vb 6.0 projects to vb.net
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
Introduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsIntroduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 Fundamentals
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
User define data type In Visual Basic
User define data type In Visual Basic User define data type In Visual Basic
User define data type In Visual Basic
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)
 

Ähnlich wie Vb6 ch.6-3 cci

Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exitsKranthi Kumar
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsHicham Khallouki
 
Chapter 06
Chapter 06Chapter 06
Chapter 06Terry Yoast
 
Devry cis 321 week 7 milestone 5 and milestone 6
Devry cis 321 week 7 milestone 5 and milestone 6Devry cis 321 week 7 milestone 5 and milestone 6
Devry cis 321 week 7 milestone 5 and milestone 6uopassignment
 
Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812Pantech ProLabs India Pvt Ltd
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptxkulmiyealiabdille
 
File(2)
File(2)File(2)
File(2)Mahi G
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantAnkit Sharma
 
Module 3.8 application testing.ppt
Module 3.8 application testing.pptModule 3.8 application testing.ppt
Module 3.8 application testing.pptssuserd973fe
 
04b swing tutorial
04b swing tutorial04b swing tutorial
04b swing tutorialRobert Wolf
 
04b swing tutorial
04b swing tutorial04b swing tutorial
04b swing tutorialPrakash Sweet
 
Windows Debugging Tools - JavaOne 2013
Windows Debugging Tools - JavaOne 2013Windows Debugging Tools - JavaOne 2013
Windows Debugging Tools - JavaOne 2013MattKilner
 
User exit training
User exit trainingUser exit training
User exit trainingJen Ringel
 
3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdf3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdfEMERSON EDUARDO RODRIGUES
 
UiPath Task Capture training.pdf
UiPath Task Capture training.pdfUiPath Task Capture training.pdf
UiPath Task Capture training.pdfCristina Vidu
 
Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environmentmuthusvm
 

Ähnlich wie Vb6 ch.6-3 cci (20)

Visusual basic
Visusual basicVisusual basic
Visusual basic
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exits
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
 
Chapter 06
Chapter 06Chapter 06
Chapter 06
 
Devry cis 321 week 7 milestone 5 and milestone 6
Devry cis 321 week 7 milestone 5 and milestone 6Devry cis 321 week 7 milestone 5 and milestone 6
Devry cis 321 week 7 milestone 5 and milestone 6
 
Picaxe manual5
Picaxe manual5Picaxe manual5
Picaxe manual5
 
Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812Getting started with code composer studio v3.3 for tms320 f2812
Getting started with code composer studio v3.3 for tms320 f2812
 
Login Project with introduction .pptx
Login Project with introduction .pptxLogin Project with introduction .pptx
Login Project with introduction .pptx
 
File(2)
File(2)File(2)
File(2)
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional Consultant
 
Module 3.8 application testing.ppt
Module 3.8 application testing.pptModule 3.8 application testing.ppt
Module 3.8 application testing.ppt
 
04b swing tutorial
04b swing tutorial04b swing tutorial
04b swing tutorial
 
java swing tutorial for beginners(java programming tutorials)
java swing tutorial for beginners(java programming tutorials)java swing tutorial for beginners(java programming tutorials)
java swing tutorial for beginners(java programming tutorials)
 
04b swing tutorial
04b swing tutorial04b swing tutorial
04b swing tutorial
 
Windows Debugging Tools - JavaOne 2013
Windows Debugging Tools - JavaOne 2013Windows Debugging Tools - JavaOne 2013
Windows Debugging Tools - JavaOne 2013
 
User exit training
User exit trainingUser exit training
User exit training
 
3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdf3- Siemens Open Library - Example Object Configuration.pdf
3- Siemens Open Library - Example Object Configuration.pdf
 
UiPath Task Capture training.pdf
UiPath Task Capture training.pdfUiPath Task Capture training.pdf
UiPath Task Capture training.pdf
 
Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environment
 
Demonstrating caf.doc
Demonstrating caf.docDemonstrating caf.doc
Demonstrating caf.doc
 

KĂŒrzlich hochgeladen

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 

KĂŒrzlich hochgeladen (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Vb6 ch.6-3 cci

  • 1. VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI) Chapter 6 Multiple Forms Adding Form to a Project Steps for adding a form to a project: 1. Select Project Menu from VB6 Menu bar. 2. Choose Add Form. 3. Select Form from the Add Form Dialog Box. --------------------------------------------------------------------------------------------------------------------------- ----------- The Hide and Show Methods Display a form with a Show method and conceal a form with the Hide Method. Show Method General form - FormName.Show [Style] The optional style determines whether the form will display modeless or modal. The values for Style can be 0-modeless and 1-modal, default is 0. You can also use VB intrinsic constants; vbModal and vbModeless. When the form is displayed as modal, the user must respond to the form in some way. No other code can execute until the modal form has been responded to and hidden or unloaded. If the form is displayed as modeless, the user may switch to another form. Examples frmMain.Show 1 frmMain.Show vbModal frmMain.Show vbModeless frmMain.Show Hide Method General Form – FormName.Hide Hide method is used to remove a form from the screen. Example – frmMain.Hide --------------------------------------------------------------------------------------------------------------------------- Form_Load and Form_Activate The first time a form is displayed in a project, VB generates two events—a Form_Load and Form_Activate. The Form_Load event calls the form module into memory. 1
  • 2. VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI) The Form_Activate event occurs after the Form_Load event, just as control is passed to the Form. Each time the form is shown the Form_Activate event occurs and not the Form_Load event. --------------------------------------------------------------------------------------------------------------------------- Me Keyword The current form can be referred by using the special Keyword Me. Me acts like a variable and refers to the current active form. Use Me in place of Form name when coding form statements and methods. Example: Unload Me Me.Hide --------------------------------------------------------------------------------------------------------------------------- Load and Unload Statements Load – When you show a form, the Load is done automatically. The only time you will code a Load statement is when you want to load a form but not display. General Form – Load FormName Example: Load frmLogIn Unload –To remove a form from the screen, hide it unload it. Hiding a form removes it from the screen, but the form still remains in the memory. If you do not need the form for further execution, the best way is to unload the form. General form – Unload FormName Example: Unload frmLogin --------------------------------------------------------------------------------------------------------------------------- Example of SHOW/ HIDE and LOAD /UNLOAD Standard Code Module A Standard Code Module is a basic procedure with the extension .bas which is added to the project. Standard code module does not contain Form Window. It only contain a Code window. A standard code module has general declaration section and procedure just like form module. 2
  • 3. VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI) They can contain global (available to the whole application) or module-level declarations of variables, constants, types, external procedures, and global procedures. Standard Code Module is visible to all procedures in the module but not to procedure in the form module. Adding a Standard Code Module to Project Steps for adding a Standard Code Module to a project: 1. Select Project Menu from VB6 Menu bar. 2. Choose Add Module. 3. Select Module from the Add Module Dialog Box. --------------------------------------------------------------------------------------------------------------------------- Global/ Public Variables If you want variables and constants to be accessible to more than one form in the project, they must be global variables. To declare global variables, use the Public statement in place of the Dim statement. General form – Public Identifier [As Datatype] Public Const Identifier [As Datatype] = Value A public variable or constant has a prefix of g. Static Variables Static variables retain their value for the life of the project, rather than being initialized for each call to a procedure. If you need to retain the value in a variable for multiple calls to a procedure, such as a running total, declare it as Static. General form – Static Identifier [As DataType] Static statements can appear only in procedures; Static statements never appear in the General Declarations section of a module. Static variables do not require a scope prefix, since all static variables are local. --------------------------------------------------------------------------------------------------------------------------- Setting the Startup Form By default, the first form in your application is designated as the startup form. When your application starts running, this form is displayed. If you want a different form to display when your application starts, you must change the startup form. To change the startup form 1. From the Project menu, choose Project Properties. 2. Choose the General tab. 3. In the Startup Object list box, select the form you want as the new startup form. 4. Choose OK. --------------------------------------------------------------------------------------------------------------------------- 3
  • 4. VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI) Starting Without a Startup Form : SUB MAIN() Sometimes you might want your application to start without any form initially loaded. For example, you might want to execute code that loads a data file and then displays one of several different forms depending on what is in the data file. You can do this by creating a Sub procedure called Main in a standard module, as in the following example: Sub Main() frmSplash.Show vbModeless Load frmMain End Sub This procedure must be a Sub procedure, and it cannot be in a form module. To set the Sub Main procedure as the startup object, from the Project menu, choose Project Properties, select the General tab, and select Sub Main from the Startup Object box. --------------------------------------------------------------------------------------------------------------------------- Displaying a Splash Screen on Startup If you need to execute a lengthy procedure on startup, such as loading a large amount of data from a database or loading several large bitmaps, you might want to display a splash screen on startup. A splash screen is a form, usually displaying information such as the name of the application, copyright information, and a simple bitmap. The screen that is displayed when you start Visual Basic is a splash screen. To display a splash screen, use a Sub Main procedure as your startup object and use the Show method to display the form: Private Sub Main() ' Show the splash screen. frmSplash.Show ' Add your startup procedures here. 
 ' Show the main form and unload the splash screen. frmMain.Show Unload frmSplash End Sub The splash screen occupies the user's attention while your startup routines are executing, giving the illusion that the application is loading faster. When the startup routines are completed, you can load your first form and unload the splash screen. Adding a Splash Screen to Project Steps for Adding a Splash Screen to Project: 1. Select Project Menu from VB6 Menu bar. 2. Choose Add Form. 3. Select Splash Screen from the Add Form Dialog Box. 4
  • 5. VISUAL BASIC 6 – 3 CUBE COMPUTER INSTITUTE (3CCI) --------------------------------------------------------------------------------------------------------------------------- Displaying a About Box Adding an About Box to Project Steps for Adding a About Box to Project: 1. Select Project Menu from VB6 Menu bar. 2. Choose Add Form. 3. Select About Box from the Add Form Dialog Box. About Box contains the Application Title, Version, and App Description placeholders with information specific to your application. 5