22
2003 : . Copyright Ismail M Rom , . i PPU All Rights Reserved 1 م ي ح ر ل ا ن م ح ر ل له ا ل م ا س ب م ي ح ر ل ا ن م ح ر ل له ا ل م ا س بPalestine Polytechnic Palestine Polytechnic University University College of Administrative science and College of Administrative science and informatics informatics Visual Basic 6 Visual Basic 6

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

  • View
    217

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

1

الرحيم الرحمن الله الرحيم بسم الرحمن الله بسم

Palestine Polytechnic UniversityPalestine Polytechnic UniversityCollege of Administrative science and informaticsCollege of Administrative science and informatics

Visual Basic 6Visual Basic 6

Page 2: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

2

Lab1Lab1SAMS: DAY2 SAMS: DAY2

Working WithWorking With Visual BasicVisual Basic

Page 3: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

3

IntegratedIntegrated Development Development EnvironmentEnvironment

IIDDEE

Page 4: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

4

VB Integrated Development Environment (IDE)

Page 5: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

5

The New Project Window

This window appears in the following cases:

1. When you start VB.

2. When you start New Project from the file menu.

Page 6: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

6

The Title Bar

The line at the top of the window which shows:

1. The project name.

2. The project status (Design, Run).

Page 7: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

7

The Menu Bar

Note: Each menu item has it’s own pull down menu which contains another menu items.

Menu Item

Page 8: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

8

The Tool Bar

•Contains buttons that performs specific tasks.

•To Show/Hide Tool Bar: View, Toolbars

Page 9: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

9

The Tool Box

It’s a collection of buttons called Controls that enables you to implement the graphical user interface.

Types:1. Standard: Built-in.

2. Professional: added to the project ( special file).

Page 10: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

10

The Tool Box

Page 11: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

11

The Form Window

Page 12: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

12

The Form Window

• The background window that the user see during the program execution.

• The forms are given a default name Form1, From2…

• On the form you can place the controls from the toolbox required for the user interface.

Page 13: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

13

The Project Window

•A window that lists all project files (Forms, modules… See Page 40)

•You can use the context window to Add, Save, Remove file.

Page 14: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

14

The Properties WindowProperty Name

Property Value

Page 15: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

15

The Properties Window• Lists the properties of the controls (objects).

• Each control and form has it’s own properties.

• Each property consists of :– Name.– Value.

• You can change the values in the properties window, and this is reflected automatically on the associated Control(Object).

Page 16: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

16

The Form Layout Window

• Show a preview of the from window’s location at Run-Time.

Screen Form

Page 17: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

17

Placing Controls on the Form

Ways:

1- Double-click the control you want from the ToolBox.

2- Choose the Control from the ToolBox, assign it’s place on the from.

Page 18: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

18

Lab1 Training

Part I: Examples

1- Design a VB project, to perform Greetings.

2- Saving the project.

Page 19: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

19

Lab1 TrainingPart II: Questions

Question I

• Start VB.

• Close the Form, Project, Properties, and Toolbox windows.

• Now perform the actions necessary to make each window appear on-screen.

Page 20: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

20

Lab1 Training

Question II• Start a new project in Visual Basic.

• Delete any custom controls from the project.

• Add three text boxes and two command buttons.

• Change the Caption property of each button, Use whatever caption you want

• Change the Text property of the text boxes so that they are blank (Empty).

Page 21: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

21

Lab1 Training

Design the greeting interface as follow:

• When you click University Greeting, the message “Welcome to PPU University” will appear in the textbox.

• When you click College Greeting, the message “Welcome to Adm. College” will appear in the textbox.

• When you click End the program ends.

Question III

Page 22: Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved

22

Lab1 EndLab1 End