1. s:\courses\csse\ibrahima\cs2340\notes folder section1 folder section2 2

17
1 CS 2340 Programming in VB.NET

Upload: gary-jenkins

Post on 03-Jan-2016

225 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

1

CS 2340Programming in VB.NET

Page 2: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

S:\Courses\CSSE\ibrahima\CS2340\Notes

Folder Section1Folder Section2

2

Notes Folder

Page 3: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Web Site

3

Programming Rules

Page 4: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Start MS Visual Studio 2012 New Project… Visual Basic Windows Windows Form Application Name: ibrahima_XXXn

4

Create a New Project

Page 5: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Make sure you know where is your program!

Save all Create Solution folder: Uncheck Browse location Could change project / solution names Check program location

5

Save Project and Solution

Page 6: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Double click the project file Double click the solution file Open MS Visual Studio, then

Open project Recent projects

6

Reopen an Existing Project

Page 7: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

TextBox Get Input Display Output

Label Display Information / Output

Button User action. . .

7

Windows Controls

Page 8: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Name: lblName Font

◦ Name◦ Size◦ Bold◦ Italic◦ Strikeout◦ Underline

Size AutoSize TextAlign . . .

8

Label

Page 9: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Name: txtName Size Multiline ReadyOnly BackColor TabStop TabIndex . . .

9

TextBox

Page 10: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Name: btnHello Text TextAlign Size TabStop TabIndex . . .

10

Button

Page 11: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Menu View Tab Order Clicking the controls in order to change

TabIndex Close Tab Order Multiple controls could receive the same

TabIndex value

11

Changing TabIndex

Page 12: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Align ◦ Tops ◦ Lefts ◦ ...

Make Same Size

12

Menu Format

Page 13: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Horizontal Spacing Vertical Spacing Center in Form

◦ Horizontally ◦ Vertically

13

Menu Format

Page 14: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Order ◦ Bring to Front ◦ Send to Back

Lock Controls

14

Menu Format

Page 15: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

The button’s Click Event Users click a button when they want to

do something.

Event Procedure Will be called when the event happens.

We will write the event procedure

Event procedure template Double click the button Select Events on Properties Windows 15

Click Event

Page 16: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

Declare variables

Get Input

Process Data

Output Result

16

Event Procedure Pseudo Code

Page 17: 1. S:\Courses\CSSE\ibrahima\CS2340\Notes Folder Section1 Folder Section2 2

‘ Operators “&” and “+” append stringsMessageBox.Show("Hello, " & theName + "!”)

MessageBox.Show("Hello, " & theName + "!", "Lab 1”, _ MessageBoxButtons.OK, _ MessageBoxIcon.Information)

17

String Operations