1. Trang chủ
  2. » Công Nghệ Thông Tin

Lecture Learning programming using Visual Basic Net – Chapter 2 Creating simple Visual Basic NET windows applications

42 441 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 42
Dung lượng 532 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Learning objectives of this chapter include The Integrated development environment (IDE) is used for modern software development; the IDE contains tools to write code, build a GUI , and test and debug applications; overview of the application construction process; design issues are addressed;...

Trang 1

CHAPTER TWO

Creating Simple Visual Basic NET Windows Applications

Trang 2

Chapter Introduction

• The Integrated Development Environment (IDE)

is used for modern software development.

• The IDE contains tools to write code, build a

GUI , and test and debug applications.

• Overview of the application construction

process.

• Design issues are addressed.

• Visual Basic NET controls are examined.

• The MsgBox statement and InputBox() function

are visited.

Trang 3

• Design and construct simple complete

applications from scratch

• Explain the structure of Visual Basic NET

• List the characteristics of several Visual

Basic NET controls

• Identify the purpose of each major control

of the Visual Basic NET IDE

Trang 4

• Overview of the Construction Process

– Visual Basic NET runs under Windows.

– The programmer creates the application.

– The project is an application under

construction.

– The application is saved to disk periodically.

– An executable file is generated from the

finished application program.

Trang 5

Visual Basic NET’s Three Modes

• Design Mode

– Placing, arranging, and customizing the

appearance of buttons, labels, and other

controls on a form.

– Writing processing scripts (source code).

– Saving the solution.

– Making an executable file.

Trang 6

• Run Mode

– Executes the solution.

– Used to evaluate the workability of a part of

the project.

– Used to show the user how the solution will

work.

Trang 7

Visual Basic NET’s Three Modes

(cont.)

• Break Mode

– Helps the developer with debugging.

– Enables the developer to switch back to run

mode or design mode.

Trang 8

Design Time and Run Time

• In design mode, the project is in design

time

• In run mode, the project is in run time

• Some errors can be found and corrected

in design time

• Other errors can only be detected during

run time

Trang 9

2.2 Overview of Controls

• Standard controls are used to create friendly applications

user-• Standard controls help users lower the

learning curve for new programs

Trang 10

Categories of Controls

• Trigger: Initiate processing

– Ex Button, MainMenu, and Timer

• Input: Get data from user

– Ex TextBox, RadioButton, and CheckBox

• Output: Display results to user

– Ex Label, DataGrid, and ListView

Trang 11

Categories of Controls (cont.)

• Organize: Group other controls

– Ex Form, GroupBox, and Panel

• Data Access: Interface with databases

– Ex Entire Data Group and DataGrid

Trang 12

The Correct Control for the Job

• Chose controls to satisfy user

Trang 13

2.3 The Visual Basic NET Development Environment

• The IDE helps develops create efficient

and effective solutions

• The IDE for Visual Basic NET is common

to all the other tools available in the Visual Studio NET suite

Trang 14

Getting Started

• Open an existing project or begin a new

project from the Start Page

• Use the My Profile option to set up the

IDE

Trang 15

Visual Basic NET Solution

Structure

• Every application will be organized as a

“solution.”

• Solution Explorer is an interface for

viewing and managing containers and

associated items

• Items are files that make up your project,

such as forms, source files, and classes

Trang 17

• Avoid the temptation to use the Save

As…, save option

• Use the Save and Save All Toolbar icons

Trang 18

• Many of the features of the Visual

Basic NET IDE have been introduced

• Next, some of the controls to write simple

programs will be introduced

• Experimentation is encouraged

• Hands-on experience is important

Trang 19

2.4 Introducing the Windows Form

Trang 20

2.5 The Button Control

• React to the click of the use

• Perform a task associated with the name

of the button that is displayed on its face

Trang 21

Appearance and Use

• Appears as a rectangular-shaped control

on a form

• Its face can display text, an image, or

both

• The face of the button should clearly

indicate its function

Trang 23

Common Properties of the Button

Trang 24

• Components are able to respond to

events

• The click event is generated when the

user clicks the mouse button

• You write code to handle events

• Double-click the Button control to

automatically open the code window

Trang 25

2.6 The Label Control

• Used to display information to the user

• Used to label other controls or show

results of a calculation

– Ex Check box and radio button labels.

Trang 26

Appearance and Use

• Appears as a rectangular area that can be filled with text

• You have some control over size and

alignment of text

• You can include a border around the label

Trang 27

• Many of the Button control properties

apply to the Label control

• The Text Property is the most-used

property for the Label control

Trang 29

• Example 2.1 Using the Label Control

– Demonstrates two main uses of the Label

control

• To display a message to the user.

• To display “labeling” information for the user.

Trang 30

2.7 The TextBox Control

• Provides an area for the user to type while the program runs

Trang 31

Appearance and Use

• Displays as a rectangular area that

provides the user a place to type

• You can limit the user types

• You can also surround the TextBox with a border

Trang 32

• Some of the TextBox control properties

are only available at run time

• The value of the Text property is used

most frequently

• Control of user entry is shared between

properties and events

• The PasswordChar property allows you to

Trang 33

Properties (cont.)

• TextLength property determines the

number of characters contained in a

textbox

• Selection… properties provide information

on user selections in the TextBox control

Trang 35

Focus means the user is currently working

with the specific control

• Enter - Occurs when input focus is

Trang 37

Common Events for the TextBox

Trang 38

InputBox Function

• Two alternate ways to receive information from the user and to display information on the screen

Trang 39

MsgBox Statement

• The MsgBox statement will display

information that requires user intervention

– MsgBox(“A prompt”, Buttons,”A title”)

Trang 40

InputBox() Function

• The InputBox() function requests

information from the user with a dialog

box It requires user intervention

– InputBox(“A prompt”,”A title”,”A default

response”)

Trang 41

Chapter Summary

• An application being developed in Visual

Basic NET is called a project.

• Visual Basic NET uses three modes of

operation.

• The Visual Basic NET IDE contains a

number of development tools.

• During the design phase, descriptive names

should be applied to important controls.

Trang 42

Chapter Summary (cont.)

• The Windows Form control is used to contain the other GUI controls.

• The Button control enables the user to trigger

a process by a click event.

• The MsgBox statement provides an alternate means to provide information to the user.

• The InputBox() function provides an alternate way to receive information from the user.

Ngày đăng: 16/05/2017, 14:47

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN