SlideShare uma empresa Scribd logo
1 de 5
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 
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
 
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
 
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
 

Mais procurados (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)
 

Semelhante a VISUAL BASIC 6 CHAPTERS FORMS AND MODULES

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
 
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
 
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
 

Semelhante a VISUAL BASIC 6 CHAPTERS FORMS AND MODULES (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
 
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
 
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
 

Último

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Último (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

VISUAL BASIC 6 CHAPTERS FORMS AND MODULES

  • 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