SlideShare une entreprise Scribd logo
1  sur  32
Creating Windows Forms

Objectives
In this lesson, you will learn to:
Identify the features of Windows Forms
Identify various language features required to work with
Windows Forms
Identify various Windows Forms controls
Create Windows Forms




   ©NIIT                       Creating Windows Forms/Lesson 2/Slide 1 of 30
Creating Windows Forms

Understanding the User Interface
 A user interface is the means by which a user interacts with
  an application. A well-designed user interface is an
  effective means of making an application user-friendly.
 Types of User Interfaces
     Character user interface (CUI)
     Graphical user interface (GUI)




   ©NIIT                     Creating Windows Forms/Lesson 2/Slide 2 of 30
Creating Windows Forms

Windows Form
 Is a representation of any window displayed in an
  application.
 Is used to accept input from a user and display information.




   ©NIIT                    Creating Windows Forms/Lesson 2/Slide 3 of 30
Creating Windows Forms

Windows Forms (Contd.)
Windows Form properties:
    Are used to determine the appearance of a Windows
     Form at run time.
    Some commonly used properties are:
          ®Name
          ®BackColor
          ®BackgroundImage
          ®Font
          ®Size
          ®StartPosition
          ®Text
          ®WindowState
  ©NIIT                      Creating Windows Forms/Lesson 2/Slide 4 of 30
Creating Windows Forms

Windows Forms (Contd.)
Windows Forms events:
    Click
    Closed
    Deactivate
    Load
    MouseMove
    MouseDown
    MouseUp



  ©NIIT                  Creating Windows Forms/Lesson 2/Slide 5 of 30
Creating Windows Forms

Windows Forms (Contd.)
Windows Forms methods:
   Show()
   Activate()
   Close()
   SetDesktopLocation()




  ©NIIT                   Creating Windows Forms/Lesson 2/Slide 6 of 30
Creating Windows Forms

Visual Basic.NET Language Features
Data types:
    Byte
    Short
    Integer
    Long
    Single
    Double
    Decimal
    Boolean

  ©NIIT               Creating Windows Forms/Lesson 2/Slide 7 of 30
Creating Windows Forms

Visual Basic.NET Language Features (Contd.)
Data types: (Contd.)
    Char
    String
    Date
    Object




  ©NIIT                 Creating Windows Forms/Lesson 2/Slide 8 of 30
Creating Windows Forms

Visual Basic .NET Language Features (Contd.)
Variables
    Allow you to store data.
    Have a data type and a name.
    Can be declared by using the Dim statement.
Arrays
    Are collections of values of the same data type.
    Contain elements that can be accessed using a single
     name and an index number representing the position of
     the element within the array.


  ©NIIT                    Creating Windows Forms/Lesson 2/Slide 9 of 30
Creating Windows Forms

Visual Basic .NET Language Features (Contd.)
    Are declared using the following syntax:
     Dim arrayname(Number-of-elements) as
     datatype
    Can be resized using the Redim statement.
Operators
    Are used to process the data entered by a user.
    Can be categorized as follows:
          ®Arithmetic operators such as +, -, *, /, , and Mod
          ®Comparison operators such as =, , , =, =, and
           
          ®Logical operators such as And, Or, Not, and Xor
          ®Concatenation operators such as  and +
  ©NIIT                       Creating Windows Forms/Lesson 2/Slide 10 of 30
Creating Windows Forms

Visual Basic .NET Language Features (Contd.)
Control flow constructs
    Decision structures
           ®If-then-else
           ®Select case
    Loop structures
           ®While-End while
           ®Do-Loop
           ®For-Next
    Nested control statements

   ©NIIT                      Creating Windows Forms/Lesson 2/Slide 11 of 30
Creating Windows Forms

Just a Minute…
1. Write a loop structure to display all odd numbers between
   1 and 100.
2. Write the construct to check whether the character stored
   in the variable X is a vowel and display an appropriate
   message.




  ©NIIT                   Creating Windows Forms/Lesson 2/Slide 12 of 30
Creating Windows Forms

Problem Statement 2.D.1
For the Call Center application, a startup screen needs to be
provided to accept the user name and password. The
application should allow the user to enter the user name and
password for a maximum of three times. If in all of the three
attempts, a wrong user name and password is entered, the
application should display an error and close.




   ©NIIT                   Creating Windows Forms/Lesson 2/Slide 13 of 30
Creating Windows Forms

Task List
 Identify the variables required to store the values in the
  application.
 Identify the controls to be used for accepting input from the
  user.
 Identify the mechanism to validate the user input.
 Create a Windows Form.
 Add controls to the Windows Form.
 Write the code to validate the user input.
 Execute the application.



   ©NIIT                     Creating Windows Forms/Lesson 2/Slide 14 of 30
Creating Windows Forms

Task 1: Identify the variables required to store the
values in the application.
Result:
The variables required for accepting the login details from a
      user are:
    Counter
    Login Name
    Password




   ©NIIT                   Creating Windows Forms/Lesson 2/Slide 15 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user.
Visual Basic .NET provides a number of controls that can be
 added to a form:
    TextBox
           ®Is used to display text to a user or accept input from
            a user.
           ®Has the following properties:
              ® Text

              ® Multiline

              ® Passwordchar


   ©NIIT                       Creating Windows Forms/Lesson 2/Slide 16 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    Label
          ®Is used to provide information or description of
           another control on the Windows Form.
          ®Has the following properties:
             ® Text
             ® AutoSize




  ©NIIT                       Creating Windows Forms/Lesson 2/Slide 17 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    LinkLabel
       ®Is used to display the text as a link.
       ®Has the following properties:
          ® LinkColor
          ® ActiveLinkColor
          ® DisabledLinkColor
          ® LinkVisited




  ©NIIT                    Creating Windows Forms/Lesson 2/Slide 18 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    ListBox
          ®Is used to display a list of items to a user.
          ®Can be populated by using the Add() method of the
           Items collection.
          ®Has the following properties:
             ® SelectionMode

             ® Sorted

             ® SelectedIndex

             ® SelectedItem

  ©NIIT                        Creating Windows Forms/Lesson 2/Slide 19 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    ComboBox
          ®Is used to display a drop-down list of items.
          ®Can be populated by using the Add() method of
           the Items collection.
          ®Has the following properties:
             ® Text

             ® Sorted

             ® SelectedIndex

             ® SelectedItem



  ©NIIT                       Creating Windows Forms/Lesson 2/Slide 20 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    CheckBox
          ®Is used to set Yes/No or True/false options.
          ®Has the following properties:
             ® Text

             ® Checked




  ©NIIT                      Creating Windows Forms/Lesson 2/Slide 21 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    RadioButton
          ®Is used to provide a set of mutually exclusive
           options to the user.
          ®Has the following properties:
             ® Text

             ® Checked




  ©NIIT                      Creating Windows Forms/Lesson 2/Slide 22 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
    GroupBox
           ®Is used to group related controls.
    Button
           ®Is used to perform an action when a user clicks it.
           ®Has the Text property, which is used to set the text
            displayed on the button.
    StatusBar
           ®Is used to display the status information.
           ®Has the following properties:
              ® ShowPanels

              ® Text
   ©NIIT                       Creating Windows Forms/Lesson 2/Slide 23 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
Some common properties found in most of the controls are:
    Name
    Visible
    Location
    Enabled




   ©NIIT                  Creating Windows Forms/Lesson 2/Slide 24 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
Some common events found in most of the controls are:
    KeyDown
    KeyUp
    KeyPress
    MouseDown
    MouseUp
    MouseMove
    ReSize
    VisibleChanged



   ©NIIT                  Creating Windows Forms/Lesson 2/Slide 25 of 30
Creating Windows Forms

Task 2: Identify the controls to be used for accepting
input from the user. (Contd.)
Result:
You will use the following controls for the given problem
statement:
    Label
    TextBox
    Button




   ©NIIT                   Creating Windows Forms/Lesson 2/Slide 26 of 30
Creating Windows Forms

Task 3: Identify the mechanism to validate the user input.
Result:
The program should use the If-Then construct to validate
 the user name and the password. The If‑Then construct
 can also be used to ensure that value of the counter is not
 greater than 3.




   ©NIIT                   Creating Windows Forms/Lesson 2/Slide 27 of 30
Creating Windows Forms

Task 4: Create a Windows Form.
Task 5: Add controls to the Windows Form.
Task 6: Write the code to validate the user input.
Task 7: Execute the application.




   ©NIIT                  Creating Windows Forms/Lesson 2/Slide 28 of 30
Creating Windows Forms

Just a Minute…
You have created two forms named Form1 and Form2. Write
the code so that when a user clicks the OK button in Form1,
Form2 should be displayed.




   ©NIIT                  Creating Windows Forms/Lesson 2/Slide 29 of 30
Creating Windows Forms

Problem Statement 2.P.1
Diaz Telecommunications needs an application to accept
order details. The details to be accepted include order
number, date, customer ID, product ID, cost, and advance.
The product IDs should be displayed in a combo box. When
a user clicks the Save button after entering order details, the
application should verify that none of the fields is left blank
and display an appropriate message.




   ©NIIT                    Creating Windows Forms/Lesson 2/Slide 30 of 30
Creating Windows Forms

Summary
In this lesson, you learned that:
A form is used to accept input from the user and present
 information to the user.
An event gets generated on performing an action such as
 clicking the mouse or pressing a key from the keyboard.
When an event is raised, the code within the event handler
 is executed.
Variables are used to store data at run time. You can
 declare a variable by using the Dim statement.
The decision structures supported by Visual Basic .NET
 include:
      If-Then-Else
     Select-Case
   ©NIIT                     Creating Windows Forms/Lesson 2/Slide 31 of 30
Creating Windows Forms

Summary (Contd.)
 The loop structures supported by Visual Basic .NET are:
    While-End While
    Do-Loop
    For-Next
 Controls can be added to a form to accept input from the
  user or display some information on the form.
 Some commonly used controls are TextBox, Label,
  CheckBox, RadioButton, and Button.




   ©NIIT                   Creating Windows Forms/Lesson 2/Slide 32 of 30

Contenu connexe

Tendances

C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesC# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesSami Mut
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0sanket1996
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 

Tendances (7)

C# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slidesC# Tutorial MSM_Murach chapter-01-slides
C# Tutorial MSM_Murach chapter-01-slides
 
Visual basic
Visual basicVisual basic
Visual basic
 
visual basic programming
visual basic programmingvisual basic programming
visual basic programming
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 

En vedette (20)

Ilustracao67
Ilustracao67Ilustracao67
Ilustracao67
 
Alexandra tobar v_cambio climatico en San Andres Islas
Alexandra tobar v_cambio climatico en San Andres IslasAlexandra tobar v_cambio climatico en San Andres Islas
Alexandra tobar v_cambio climatico en San Andres Islas
 
Reflective essay
Reflective essayReflective essay
Reflective essay
 
Curriculum vitae rise
Curriculum vitae riseCurriculum vitae rise
Curriculum vitae rise
 
Proceso herrajes
Proceso herrajesProceso herrajes
Proceso herrajes
 
El inaceptable costo de los malos jefes
El inaceptable costo de los malos jefesEl inaceptable costo de los malos jefes
El inaceptable costo de los malos jefes
 
Mantenimiento preventivo 2
Mantenimiento preventivo 2Mantenimiento preventivo 2
Mantenimiento preventivo 2
 
Presentacion Del Caso
Presentacion Del CasoPresentacion Del Caso
Presentacion Del Caso
 
Riesgo
RiesgoRiesgo
Riesgo
 
Principio 90 10-__stephen_covey
Principio 90 10-__stephen_coveyPrincipio 90 10-__stephen_covey
Principio 90 10-__stephen_covey
 
Formatos desarrollo de requerimientos mejorado
Formatos desarrollo de requerimientos mejoradoFormatos desarrollo de requerimientos mejorado
Formatos desarrollo de requerimientos mejorado
 
Principales escritores
Principales escritoresPrincipales escritores
Principales escritores
 
Confecciones
ConfeccionesConfecciones
Confecciones
 
Plantilla gestion de riesgo4
Plantilla gestion de riesgo4Plantilla gestion de riesgo4
Plantilla gestion de riesgo4
 
Experiment Search
Experiment SearchExperiment Search
Experiment Search
 
Hello, my name is
Hello, my name isHello, my name is
Hello, my name is
 
prueba slide
prueba slideprueba slide
prueba slide
 
Jci toyp 2013 til lokalpresidenter (1)
Jci toyp 2013 til lokalpresidenter (1)Jci toyp 2013 til lokalpresidenter (1)
Jci toyp 2013 til lokalpresidenter (1)
 
2.18. Recomendaciones para la rotura del tow
2.18.  Recomendaciones para la rotura del tow2.18.  Recomendaciones para la rotura del tow
2.18. Recomendaciones para la rotura del tow
 
Belarus. Packaging
Belarus. PackagingBelarus. Packaging
Belarus. Packaging
 

Similaire à Create WinForms

LECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptxLECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptxAOmaAli
 
Vb net xp_13
Vb net xp_13Vb net xp_13
Vb net xp_13Niit Care
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 
06 win forms
06 win forms06 win forms
06 win formsmrjw
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxEliasPetros
 
vb-160518151614.pdf
vb-160518151614.pdfvb-160518151614.pdf
vb-160518151614.pdfLimEchYrr
 
vb-160518151614.pptx
vb-160518151614.pptxvb-160518151614.pptx
vb-160518151614.pptxLimEchYrr
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.pptLalRatan
 
VB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptVB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptBhuvanaR13
 
Vb net xp_08
Vb net xp_08Vb net xp_08
Vb net xp_08Niit Care
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03PCC
 

Similaire à Create WinForms (20)

LECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptxLECTURE 12 WINDOWS FORMS PART 2.pptx
LECTURE 12 WINDOWS FORMS PART 2.pptx
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Vb net xp_13
Vb net xp_13Vb net xp_13
Vb net xp_13
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Meaning Of VB
Meaning Of VBMeaning Of VB
Meaning Of VB
 
06 win forms
06 win forms06 win forms
06 win forms
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
vb.pptx
vb.pptxvb.pptx
vb.pptx
 
vb-160518151614.pdf
vb-160518151614.pdfvb-160518151614.pdf
vb-160518151614.pdf
 
vb-160518151614.pptx
vb-160518151614.pptxvb-160518151614.pptx
vb-160518151614.pptx
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Chapter2.ppt
Chapter2.pptChapter2.ppt
Chapter2.ppt
 
VB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptVB6_INTRODUCTION.ppt
VB6_INTRODUCTION.ppt
 
Vb net xp_08
Vb net xp_08Vb net xp_08
Vb net xp_08
 
VISUAL PROGRAMMING
VISUAL PROGRAMMINGVISUAL PROGRAMMING
VISUAL PROGRAMMING
 
02 gui 02
02 gui 0202 gui 02
02 gui 02
 
08 gui 11
08 gui 1108 gui 11
08 gui 11
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03
 

Plus de Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Dernier

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Dernier (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Create WinForms

  • 1. Creating Windows Forms Objectives In this lesson, you will learn to: Identify the features of Windows Forms Identify various language features required to work with Windows Forms Identify various Windows Forms controls Create Windows Forms ©NIIT Creating Windows Forms/Lesson 2/Slide 1 of 30
  • 2. Creating Windows Forms Understanding the User Interface A user interface is the means by which a user interacts with an application. A well-designed user interface is an effective means of making an application user-friendly. Types of User Interfaces Character user interface (CUI) Graphical user interface (GUI) ©NIIT Creating Windows Forms/Lesson 2/Slide 2 of 30
  • 3. Creating Windows Forms Windows Form Is a representation of any window displayed in an application. Is used to accept input from a user and display information. ©NIIT Creating Windows Forms/Lesson 2/Slide 3 of 30
  • 4. Creating Windows Forms Windows Forms (Contd.) Windows Form properties: Are used to determine the appearance of a Windows Form at run time. Some commonly used properties are: ®Name ®BackColor ®BackgroundImage ®Font ®Size ®StartPosition ®Text ®WindowState ©NIIT Creating Windows Forms/Lesson 2/Slide 4 of 30
  • 5. Creating Windows Forms Windows Forms (Contd.) Windows Forms events: Click Closed Deactivate Load MouseMove MouseDown MouseUp ©NIIT Creating Windows Forms/Lesson 2/Slide 5 of 30
  • 6. Creating Windows Forms Windows Forms (Contd.) Windows Forms methods: Show() Activate() Close() SetDesktopLocation() ©NIIT Creating Windows Forms/Lesson 2/Slide 6 of 30
  • 7. Creating Windows Forms Visual Basic.NET Language Features Data types: Byte Short Integer Long Single Double Decimal Boolean ©NIIT Creating Windows Forms/Lesson 2/Slide 7 of 30
  • 8. Creating Windows Forms Visual Basic.NET Language Features (Contd.) Data types: (Contd.) Char String Date Object ©NIIT Creating Windows Forms/Lesson 2/Slide 8 of 30
  • 9. Creating Windows Forms Visual Basic .NET Language Features (Contd.) Variables Allow you to store data. Have a data type and a name. Can be declared by using the Dim statement. Arrays Are collections of values of the same data type. Contain elements that can be accessed using a single name and an index number representing the position of the element within the array. ©NIIT Creating Windows Forms/Lesson 2/Slide 9 of 30
  • 10. Creating Windows Forms Visual Basic .NET Language Features (Contd.) Are declared using the following syntax: Dim arrayname(Number-of-elements) as datatype Can be resized using the Redim statement. Operators Are used to process the data entered by a user. Can be categorized as follows: ®Arithmetic operators such as +, -, *, /, , and Mod ®Comparison operators such as =, , , =, =, and ®Logical operators such as And, Or, Not, and Xor ®Concatenation operators such as and + ©NIIT Creating Windows Forms/Lesson 2/Slide 10 of 30
  • 11. Creating Windows Forms Visual Basic .NET Language Features (Contd.) Control flow constructs Decision structures ®If-then-else ®Select case Loop structures ®While-End while ®Do-Loop ®For-Next Nested control statements ©NIIT Creating Windows Forms/Lesson 2/Slide 11 of 30
  • 12. Creating Windows Forms Just a Minute… 1. Write a loop structure to display all odd numbers between 1 and 100. 2. Write the construct to check whether the character stored in the variable X is a vowel and display an appropriate message. ©NIIT Creating Windows Forms/Lesson 2/Slide 12 of 30
  • 13. Creating Windows Forms Problem Statement 2.D.1 For the Call Center application, a startup screen needs to be provided to accept the user name and password. The application should allow the user to enter the user name and password for a maximum of three times. If in all of the three attempts, a wrong user name and password is entered, the application should display an error and close. ©NIIT Creating Windows Forms/Lesson 2/Slide 13 of 30
  • 14. Creating Windows Forms Task List Identify the variables required to store the values in the application. Identify the controls to be used for accepting input from the user. Identify the mechanism to validate the user input. Create a Windows Form. Add controls to the Windows Form. Write the code to validate the user input. Execute the application. ©NIIT Creating Windows Forms/Lesson 2/Slide 14 of 30
  • 15. Creating Windows Forms Task 1: Identify the variables required to store the values in the application. Result: The variables required for accepting the login details from a user are: Counter Login Name Password ©NIIT Creating Windows Forms/Lesson 2/Slide 15 of 30
  • 16. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. Visual Basic .NET provides a number of controls that can be added to a form: TextBox ®Is used to display text to a user or accept input from a user. ®Has the following properties: ® Text ® Multiline ® Passwordchar ©NIIT Creating Windows Forms/Lesson 2/Slide 16 of 30
  • 17. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) Label ®Is used to provide information or description of another control on the Windows Form. ®Has the following properties: ® Text ® AutoSize ©NIIT Creating Windows Forms/Lesson 2/Slide 17 of 30
  • 18. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) LinkLabel ®Is used to display the text as a link. ®Has the following properties: ® LinkColor ® ActiveLinkColor ® DisabledLinkColor ® LinkVisited ©NIIT Creating Windows Forms/Lesson 2/Slide 18 of 30
  • 19. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) ListBox ®Is used to display a list of items to a user. ®Can be populated by using the Add() method of the Items collection. ®Has the following properties: ® SelectionMode ® Sorted ® SelectedIndex ® SelectedItem ©NIIT Creating Windows Forms/Lesson 2/Slide 19 of 30
  • 20. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) ComboBox ®Is used to display a drop-down list of items. ®Can be populated by using the Add() method of the Items collection. ®Has the following properties: ® Text ® Sorted ® SelectedIndex ® SelectedItem ©NIIT Creating Windows Forms/Lesson 2/Slide 20 of 30
  • 21. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) CheckBox ®Is used to set Yes/No or True/false options. ®Has the following properties: ® Text ® Checked ©NIIT Creating Windows Forms/Lesson 2/Slide 21 of 30
  • 22. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) RadioButton ®Is used to provide a set of mutually exclusive options to the user. ®Has the following properties: ® Text ® Checked ©NIIT Creating Windows Forms/Lesson 2/Slide 22 of 30
  • 23. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) GroupBox ®Is used to group related controls. Button ®Is used to perform an action when a user clicks it. ®Has the Text property, which is used to set the text displayed on the button. StatusBar ®Is used to display the status information. ®Has the following properties: ® ShowPanels ® Text ©NIIT Creating Windows Forms/Lesson 2/Slide 23 of 30
  • 24. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) Some common properties found in most of the controls are: Name Visible Location Enabled ©NIIT Creating Windows Forms/Lesson 2/Slide 24 of 30
  • 25. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) Some common events found in most of the controls are: KeyDown KeyUp KeyPress MouseDown MouseUp MouseMove ReSize VisibleChanged ©NIIT Creating Windows Forms/Lesson 2/Slide 25 of 30
  • 26. Creating Windows Forms Task 2: Identify the controls to be used for accepting input from the user. (Contd.) Result: You will use the following controls for the given problem statement: Label TextBox Button ©NIIT Creating Windows Forms/Lesson 2/Slide 26 of 30
  • 27. Creating Windows Forms Task 3: Identify the mechanism to validate the user input. Result: The program should use the If-Then construct to validate the user name and the password. The If‑Then construct can also be used to ensure that value of the counter is not greater than 3. ©NIIT Creating Windows Forms/Lesson 2/Slide 27 of 30
  • 28. Creating Windows Forms Task 4: Create a Windows Form. Task 5: Add controls to the Windows Form. Task 6: Write the code to validate the user input. Task 7: Execute the application. ©NIIT Creating Windows Forms/Lesson 2/Slide 28 of 30
  • 29. Creating Windows Forms Just a Minute… You have created two forms named Form1 and Form2. Write the code so that when a user clicks the OK button in Form1, Form2 should be displayed. ©NIIT Creating Windows Forms/Lesson 2/Slide 29 of 30
  • 30. Creating Windows Forms Problem Statement 2.P.1 Diaz Telecommunications needs an application to accept order details. The details to be accepted include order number, date, customer ID, product ID, cost, and advance. The product IDs should be displayed in a combo box. When a user clicks the Save button after entering order details, the application should verify that none of the fields is left blank and display an appropriate message. ©NIIT Creating Windows Forms/Lesson 2/Slide 30 of 30
  • 31. Creating Windows Forms Summary In this lesson, you learned that: A form is used to accept input from the user and present information to the user. An event gets generated on performing an action such as clicking the mouse or pressing a key from the keyboard. When an event is raised, the code within the event handler is executed. Variables are used to store data at run time. You can declare a variable by using the Dim statement. The decision structures supported by Visual Basic .NET include:  If-Then-Else Select-Case ©NIIT Creating Windows Forms/Lesson 2/Slide 31 of 30
  • 32. Creating Windows Forms Summary (Contd.) The loop structures supported by Visual Basic .NET are: While-End While Do-Loop For-Next Controls can be added to a form to accept input from the user or display some information on the form. Some commonly used controls are TextBox, Label, CheckBox, RadioButton, and Button. ©NIIT Creating Windows Forms/Lesson 2/Slide 32 of 30