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

An introduction to visual basic NET ppt

37 265 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 37
Dung lượng 582 KB

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

Nội dung

Starting and Customizing Visual Studio .NET development environment IDE  Includes programming languages such as Visual Basic .NET, C++ .NET, and C# .NET  A Windows-based application

Trang 1

An Introduction to Visual Basic NET

Trang 2

Creating a Windows-Based Application

in Visual Basic NET

Lesson A

Trang 3

Lesson A Objectives

After completing this lesson, you will be able to:

Trang 4

Starting and Customizing

Visual Studio NET

development environment (IDE)

 Includes programming languages such as Visual

Basic NET, C++ NET, and C# NET

A Windows-based application has a Windows user

interface and runs on a desktop computer

A user interface is what you see and interact with when

using an application

A Web-based application , on the other hand, has a Web

user interface and runs on a server

Trang 5

The Visual Studio NET Start Page

Trang 6

Visual Studio NET

Explorer

Dynamic Help Toolbox

Trang 7

Starting a New Project

Trang 8

Purpose of the Links Included on the Start Page

Get Started Create new projects and open existing projects

What’s New Access information about the new features in Visual Studio NET

and check for Visual Studio NET updates Online Community Contact fellow developers online

Headlines View links to the latest news from the MSDN Online Library,

including information on seminars, trade shows, and conferences, as well as training opportunities offered by Microsoft

Search Online Search the MSDN Online Library

Downloads Access the latest product updates and sample code available for

download XML Web Services Search for XML Web Services to include in your applications,

and publish your own XML Web services Web Hosting Post Web applications, for a fee, on servers provided by third-

party Internet Service Providers

My Profile Customize various program settings in the IDE

Trang 9

Visual Basic NET

Project information

Properties window

Trang 10

Working with Controls Lesson B Objectives

After completing this lesson, you will be able to:

Add a control to a form

Set the properties of a label, picture box, and button control

Select multiple controls

Center controls on the form

Set the properties of a project

Start and end an application

Enter code in the Code Editor window

Terminate an application using the Me.Close method

Trang 11

Working With Controls

Toolbox Item Description

Data Components to access data and data

sources Components Components to perform special tasks

Clipboard Ring Stores items that you have copied

General Can be used to store code snippets

Windows Forms Objects used to create user interface

Trang 12

The Toolbox Window

The Toolbox window , or toolbox , contains the tools and

other components you use when designing a user interface

designer in use

Trang 13

The Windows Form Tab

The Windows Form tab

 Contains the tools you use when designing

your user interface

 Contains 47 basic tools

 However, you can add new tools or delete existing

tools by right-clicking the tab and then clicking

Customize Toolbox on the context menu

Trang 14

Using the Label Tool

controls , that can be displayed on a form

user is not allowed to edit while the application is running

help you keep track of the various controls in the user

interface

Trang 15

Using the Label Tool

Property Description

Name Identifies the object in code

Text Displayed information

AutoSize Determines if the object resizes

itself to display all Text Location Sets the X and Y coordinates for

Trang 16

Key Form Properties

Property Description

Name Used to refer to the object

Text Caption displayed in the title bar

StartPosition Position of window on screen

BackgroundImage Image displayed on the form

Size Width and Height of window

Location Left and Top position of window

Trang 17

Changing the Property for More Than One Control at a Time

many of the objects in your user interface

The Font property allows you to change the type of font

used to display the text in the object, as well as the style and size of the font

Trang 18

A font is the general shape of the characters in the text

 Courier, Tahoma, and Microsoft Sans Serif

 Font styles include regular, bold, and italic

Trang 19

Changing the Property for More Than One Control at a Time

equaling 1/72 of an inch

specific part of the screen

time by clicking one control and then pressing and holding down the Control key as you click the other control in the form

Trang 20

Changing the Property for More Than One Control at a Time

You can use the Control+Click method to

select as many controls as you want

To cancel the selection of one of the selected controls, press and hold down the Control

key as you click the control

To cancel the selection of all of the selected controls, release the Control key, then click the form or an unselected control on the form

Trang 21

Using the Format Menu

manipulate the controls in the user interface

by their left, right, top, or bottom borders

more controls the same width or height, or both width and height

centers one or more controls either horizontally or

Trang 22

Using the PictureBox Tool

You can include a logo by displaying the

logo in a picture box control, which you

create using the PictureBox tool

Trang 23

Using the Button Tool

exit the program

 Most Windows applications provide either an Exit

option on a File menu or an Exit button for this

purpose

immediate action when clicked

Trang 24

Starting and Ending an Application

You can start an application by

automatically creates a file that can be run outside of the Visual Studio NET IDE

name as the project, but with an exe filename extension

Trang 25

Writing Visual Basic NET Code

procedure

A class definition is simply a block of code that specifies

(or defines) the attributes and behaviors of an object

class definition to create the object

Trang 26

Writing Visual Basic NET Code

The Class Name list box lists the names of the objects

included in the user interface

The Method Name list box , on the other hand, lists the

events to which the selected object is capable of

responding

You use the Class Name and Method Name list boxes to

select the object and event, respectively, that you want

to code

To help you follow the rules of the Visual Basic NET

programming language, called syntax , the Code Editor provides you with a code template for every event

procedure

Trang 27

Writing Visual Basic NET Code

procedure header

A keyword is a word that has a special meaning in a programming language

The Sub keyword is an abbreviation of the term sub

procedure , which, in programming terminology, refers

to a block of code that performs a specific task

Trang 28

Writing Visual Basic NET Code

represent information that is passed to the procedure when

it is invoked

appear in a different color from the rest of the code

A method is simply a predefined Visual Basic NET

procedure that you can call (or invoke) when needed

terminates the current application

Trang 29

The Code Window

Code Editor window tab

Class

definition

Event

procedure

Trang 30

The ExitButton’s Click Event

Procedure

Private Sub ExitButton_Click(ByVal sender As Object, _

ByVal e As System.EventArgs) Handles ExitButton.Click

Private Sub Indicates the start of a code unit that can

only be used in this class ExitButton_Click The name of the procedures is the object

name and event name connected with an underscore

sender As Object Identifies the object creating the event

e As System.EventArgs Identifies specific information about the

event Handles Identifies the object and event that this

procedure will handle

Trang 31

The Event Procedure

Private Sub ExitButton_Click(ByVal sender As Object, _

ByVal e As System.EventArgs) Handles ExitButton.Click

Me.Close()

End Sub

Trang 32

Completing the Copyright Screen

Lesson C Objectives

After completing this lesson, you will be able to:

buttons

Trang 33

Using the Timer Tool

Splash screens typically do not contain an Exit

button; rather, they use a timer control to

automatically remove the splash screen after a set

Trang 34

Using the Timer Tool

The Enabled property determines whether an object can

respond to an event

control’s Tick event procedure

after each time interval has elapsed

longer need the Exit button, so you can delete it and its

associated code

Trang 35

Setting the FormBorderStyle Property

The FormBorderStyle property determines the border style

of a Windows Form object

FromBorderStyle

setting Description

Fixed3D Fixed, three-dimensional

FixedDialog Fixed, thick dialog-style

FixedSingle Fixed, thin line

FixedToolWindow Fixed, tool window style

Trang 36

The MinimizeBox, MaximizeBox,

and ControlBox Properties

You can use a Windows Form object’s MinimizeBox

property to disable the Minimize button that appears

on the form’s title bar

Similarly, you can use the MaximizeBox property to

disable the Maximize button

Unlike most applications, splash screens typically do

not contain a title bar

You can remove the title bar by setting the Windows

Forms object’s ControlBox property to False, and then removing the text from its Text property

Trang 37

Printing Your Code

You always should print a copy of the code

entered in the Code Editor window, because the printout will help you understand and

maintain the application in the future

To print the code, the Code editor window

Ngày đăng: 24/10/2014, 10:04

TỪ KHÓA LIÊN QUAN