+ All Categories
Home > Documents > Visual Basic Express Development - SMKTBRsmktbr.tripod.com/file/VBExpressProject.pdf · Visual...

Visual Basic Express Development - SMKTBRsmktbr.tripod.com/file/VBExpressProject.pdf · Visual...

Date post: 15-May-2018
Category:
Upload: buidiep
View: 217 times
Download: 0 times
Share this document with a friend
17
K KE EM ME EN NT TE ER RI I A AN N P PE EL LA AJ J A AR RA AN N M MA AL LA AY YS S I I A A S S e e l l f f A A c c c c e e s s s s L L e e a a r r n n i i n n g g M M o o d d u u l l e e V V i i s s u u a a l l B B a a s s i i c c E E x x p p r r e e s s s s D D e e v v e e l l o o p p m me e n n t t PUSAT PERKEMBANAGN KURIKULUM KEMENTERIAN PELAJARAN MALAYSIA I I I C C C T T T L L L i i i t t t e e e r r r a a a c c c y y y f f f o o o r r r S S S e e e c c c o o o n n n d d d a a a r r r y y y S S S c c c h h h o o o o o o l l l P P P r r r o o o g g g r r r a a a m m m m m m e e e
Transcript

KKEEMMEENNTTEERRIIAANN PPEELLAAJJAARRAANN MMAALLAAYYSSIIAA

SSeellff AAcccceessss LLeeaarrnniinngg MMoodduullee

VViissuuaall BBaassiicc EExxpprreessss DDeevveellooppmmeenntt

PUSAT PERKEMBANAGN KURIKULUM KEMENTERIAN PELAJARAN MALAYSIA

IIICCCTTT LLLiiittteeerrraaacccyyy fffooorrr SSSeeecccooonnndddaaarrryyy SSSccchhhoooooolll

PPPrrrooogggrrraaammmmmmeee

ICTL for Secondary School - Visual Basic Express Module

1

1.0 What is Microsoft Visual Basic Express 2005? Visual Basic Express is a programming language for the Windows operating system. You can create various applications for your school or for your daily activities. Though it simple, it can be powerful. That is why Visual Basic Express is widely used in business, training and entertainment. 2.0 Why use Microsoft Visual Basic Express 2005? Other reasons of using Microsoft Visual Basic Express 2005 are:

• It is free to download and use! • We can create standalone Windows programs royalty free. • Full tutorial and many example programs are provided online. • It has large online community. • It uses Graphical User Interface (GUI). • It uses drag and drop interface designer. • It has interactive development environment. • It is easy to carry out debugging.

3.0 What will you produce using Microsoft Visual Basic Express 2005? It is hope that at the end of this lesson, you will be able to produce a simple program that consists of Your Biodata. In your program you will learn how to create a program that has your photo, your particulars and how to create a user log in that uses password. In doing so, you will experience using simple coding in Microsoft Visual Basic Express 2005.

3.0 Getting started with Microsoft Visual Basic Express 2005

ICTL for Secondary School - Visual Basic Express Module

2

1. Click ‘Start Program Microsoft Visual Basic 2005 Express Edition’

• Visual Basic 2005 Express will be displayed

2. To create new project, select ‘File New Project’

• Window Form Screen will be displayed

ICTL for Secondary School - Visual Basic Express Module

3

3. In ‘Visual Studio installed templates’ on the screen, select ‘Windows Application’

4. Then, name your project - Example : MyBiodata

• Click ‘OK’

ICTL for Secondary School - Visual Basic Express Module

4

5. The Form Window is central to developing Visual Basic applications. It is where you

draw your application

6. Click ToolBox at the left side of the screen and all the control will be displayed.

ICTL for Secondary School - Visual Basic Express Module

5

7. Click ‘TextBox’ control .

8. Drop onto the Form1

ICTL for Secondary School - Visual Basic Express Module

6

9. Click and drag the Textbox to resize.

10. Create another three ‘TextBox’, four ‘Label’, one ‘PictureBox’ and one ‘Button’ according

to step 7, step 8 and step 9.

11. Your form should now look like this.

12. Click File and select ‘Save all’ to save your project (Name : MyBiodata)

ICTL for Secondary School - Visual Basic Express Module

7

13. Set properties of the form, four TextBox, four Labels, one PictureBox and one Button :

Form1:

Text MyBiodata Name frmBiodata

Label1:

Text Name Label2:

Text Sex Label3:

Text IC No Label4:

Text Address TextBox1

Name txtName TextBox2

Name txtSex TextBox3

Name txtICNum TextBox4

Name txtAdd Multiline true

PictureBox1

Image ‘browse image’ Button1

Name btnExit Text Exit

ICTL for Secondary School - Visual Basic Express Module

8

14. To browse image (for PictureBox1) in Properties, click browse button 15. ‘Select Resource’ window will be displayed

16. Click ‘Local resource’ then click ‘Import’ button.

Select resource (browse button)

ICTL for Secondary School - Visual Basic Express Module

9

17. Now, choose image file (example : winter)

18. Your form should now look like this.

19. Next, set properties of the form :

Form1: Backcolor ‘browse color’(choose color) txtName Text type your name txtSex Text type your sex txtICNum Text type your IC Number txtAdd Text type your home address

ICTL for Secondary School - Visual Basic Express Module

10

20. To view the coding, double click the ‘Exit Button’ and type the coding as below:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click

Application.Exit() End Sub

ICTL for Secondary School - Visual Basic Express Module

11

21. To Run (start) program, click (F5) and window will be displayed. Now your window should look like this.

22. Press ‘Exit button’ to close your application 23. To add a new window form :

• Right click MyBiodata project. On the right frame, then choose Add click Windows Form

ICTL for Secondary School - Visual Basic Express Module

12

24. Now, your window form will look like this. Choose the ‘Windows Form’ templates and

name the form (example : frmLogin). Then click ‘Add’.

25. Your form will be displayed.

ICTL for Secondary School - Visual Basic Express Module

13

26. Create two ‘TextBox’, two ‘Label’, one ‘PictureBox’ and two ‘Button’ according to step 7,

step 8 and step 9.

27. Set properties of the form, two TextBox, two Labels, one PictureBox and one Button

Form1: Text frmLogin Name frmLogin

Backcolor ‘browse color’(choose color) Label1: Text Name Label2: Text Password TextBox1 Name txtName TextBox2 Name txtPw Passwordchar * MaxLength 6 PictureBox1 Image ‘browse image’ Button1 Name btnCancel Text CANCEL Button2 Name btnOK Text OK

ICTL for Secondary School - Visual Basic Express Module

14

28. Your form should now look like this

29. To view the coding, double click the ‘Cancel Button’ and type the coding as below:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Me.Close() End Sub

ICTL for Secondary School - Visual Basic Express Module

15

30. To view the coding, double click the ‘OK Button’ and type the coding as below:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If txtName.Text = "123" And txtPw.Text = "123" Then Form1.Show() Me.Hide() Else MessageBox.Show("Incorrect username or password, please try again") End If

End Sub

31. Before you ‘run’ the frmlogin program, on the Bar Menu, click Project choose

MyBiodata Properties.

ICTL for Secondary School - Visual Basic Express Module

16

32. MyBiodata Properties form will be displayed. Go to Startup form, click drop down menu

and choose frmLogin.

33. To save the application, click ‘Save all’

34. To Run (start) program, click (F5) and window will be displayed. Now your window should look like this.

35. To test the program, type name “123” and type Password “123”. Then click OK.

CONGRATULATIONS!!! YOU HAVE CREATED A PROGRAM!


Recommended