Lesson 10 Developing A Simple Programme
Lesson 10 Developing A Simple Programme
Developing a Simple
Programme
Create object using toolbox:
Textbox, Picturebox
Declare Variables: String, Integer,
Double
Write codes
Test and Debug
Compile the program
At the end of this lesson, students
should be able to:
1. Click ToolBox at the left side of the screen and
all the control will be displayed.
Toolbox
Figure 1
2. Click TextBox control .
Textbox
Figure 2
3. Drop onto the Form1
Textbox
4. Click and drag the Textbox to resize.
Figure 3
Figure 4
5. Create another three TextBox.
Four Text Boxes
Figure 5
6. Click Label on the ToolBox
Label
Figure 6
Label
7. Drop onto the Form1
Figure 7
8. Set properties of the form.
Rename Text : Form1 to MyBiodata
Figure 8
Rename Form1
Your Form Properties should be like this
MyBiodata
Figure 9
9. Set properties of the form.
Rename Name : Form1 to frmBiodata
frmBiodata
Figure 10
10. Click Label1
Label1
Figure 11
11. Rename Text : Label1 to Name
Label1
Figure 12
Name
Your Text Properties must be like figure
shown below.
Figure 13
Label Name
Result after rename Label1 to Name.
Figure 14
Label Properties
Label2 Text : Sex
Label3 Text : IC No
Label4 Text : Address
12. Set properties of the Label2,Label3 and
Label4 as shown below.
Table 1
13. Click Textbox1
Textbox1
Figure 15
Rename Name :TextBox1 to txtname
Figure 16
TextBox Properties
TextBox2
Name : txtSex
TextBox3
Name : txtICNum
TextBox4
Name : txtAdd
Multiline : true
14. Set properties of the TextBox2,TextBox3 and
TextBox4 as shown below.
Table 2
Figure 17
Your form should be shown as Figure 17.
15. Click PictureBox control .
PictureBox
Figure 18
16. Drop onto the MyBiodata form
PictureBox
Figure 19
Click here
Figure 20
17. To browse image (for PictureBox1)
in Properties, click browse button
18. Select Resource window will be displayed
Figure 21
Figure 22
19. Click Local resource.
Then click Import.
Step 1 : Click
Local Resource
Step 2 : Click
Import
Figure 23
20. Now, choose image file (example : winter).
Then click Open.
Step 1:Click Winter Step 2:Click Open
21. Your form should now look like this
Figure 24
22. Click Button control on the Toolbox
Button
Figure 25
23. Drop onto the MyBiodata form
Button1
Button1
Figure 26
Figure 27
Button1
Name btnExit
Text Exit
24. Set properties of the button1
Exit
25. Double click button Exit
Double click here
Figure 28
26. 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
Figure 29
Backcolor
Background :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
27. Next, set properties of the form :
Table 3
28. To debug program, click Debug >>
Start Debugging on menu bar.
29. To Run (start) program, click
(F5) and window will be displayed.
Now your window should look like
this.
30. Press Exit button to close your
application.
Figure 30