You are on page 1of 34

VISUAL PROGRAMMING (CBVP2103)

FACULTY OF INFORMATION
TECHNOLOGY AND MULTIMEDIA COMMUNICATION

SEMESTER 3 /2011

CBVP2103
VISUAL PROGRAMMING

MATRICULATION NO:
IDENTITY CARD NO.

TELEPHONE NO.

E-MAIL

LEARNING CENTRE

KELANTAN LEARNING CENTRE

VISUAL PROGRAMMING (CBVP2103)


Instruction:
1. The box link
http://www.box.net/shared/zydjp8jy4d8zn0ke2gg
2. PROGRAM OPEN UNIVERSITY MALAYSIA LIBRARY
3. Put the programming program file in directory c:\ after get the coding link from
Box

txtName

txtBooksRead
txtName
lblBonusPoint
txtTotalBooksRead
txtAverageBooksRead

cmdCulculate

cmdTotalName

cmdTotalBooksRead

cmdAverage

VISUAL PROGRAMMING (CBVP2103)


4. MENU
a. FILE > Points > Summary > Exit

VISUAL PROGRAMMING (CBVP2103)


b. EDIT > Clear >_______ > Font > Color

VISUAL PROGRAMMING (CBVP2103)


c. HELP > About

VISUAL PROGRAMMING (CBVP2103)

Total Name

VISUAL PROGRAMMING (CBVP2103)

To get the Bonus


Point

VISUAL PROGRAMMING (CBVP2103)


Use the point menu in
the sub menu to get
Bonus Point

VISUAL PROGRAMMING (CBVP2103)

The Message Box appear


when the number of
books read is empty.

VISUAL PROGRAMMING (CBVP2103)

The number of
books read = 4

10

VISUAL PROGRAMMING (CBVP2103)

Enter points in the sub


menu to get the Bonus
Point.

11

VISUAL PROGRAMMING (CBVP2103)


The number of bonus
point appear

12

VISUAL PROGRAMMING (CBVP2103)


Enter number of books
read = 5

Then the total Books


Read appear

13

VISUAL PROGRAMMING (CBVP2103)

Summary menu in the sub


menu to get the Average
no of books read

14

VISUAL PROGRAMMING (CBVP2103)

Message box appear


when no value in the
number of books read

15

VISUAL PROGRAMMING (CBVP2103)

Get the Total Books read when using


the summary in the sub menu.

16

VISUAL PROGRAMMING (CBVP2103)

Get the total books read when


pressing the button total
Books Read below.

17

VISUAL PROGRAMMING (CBVP2103)

When enter the no of books read


is 5 then the total books read will
be 5. But when adding the no of
books read is 5 again, the total
books read will accumulate with
10.

18

VISUAL PROGRAMMING (CBVP2103)

The average book will get when


pressing the Average button below
after enter the number of books read

19

VISUAL PROGRAMMING (CBVP2103)

Clear Menu in sub menu


to reset the data.

20

VISUAL PROGRAMMING (CBVP2103)

Font Menu in sub menu to change font


the data in bonus point

21

VISUAL PROGRAMMING (CBVP2103)

Font Menu to change any


font

22

VISUAL PROGRAMMING (CBVP2103)

Font has change in the bonus


point

23

VISUAL PROGRAMMING (CBVP2103)

Color Menu in sub menu to


change color the data in bonus
point

24

VISUAL PROGRAMMING (CBVP2103)

Color Menu to change any


color

25

VISUAL PROGRAMMING (CBVP2103)

Color has change in the bonus


point

26

VISUAL PROGRAMMING (CBVP2103)

About menu in the sub menu.


To show the programmer
who made this system library.

27

VISUAL PROGRAMMING (CBVP2103)

Message box to show


about the programmer .

28

VISUAL PROGRAMMING (CBVP2103)


The Open University Malaysia Library Interface

3) The Programming Coding.

29

VISUAL PROGRAMMING (CBVP2103)


Option Explicit
Dim intBooksRead, intTotalBooksRead As Integer
Private Sub cmdAverage_Click()
Dim intAverageBooksRead As Integer
'Average Book's Read
intAverageBooksRead = intTotalBooksRead / 3
txtAverageBooksRead.Text = intAverageBooksRead
End Sub
Private Sub cmdCulculate_Click()
Dim intBooksRead, intBonusPoint As Integer
intBooksRead = txtBooksRead.Text
intBonusPoint = lblBonusPoint.Text
If (intBooksRead <= 3) Then
intBonusPoint = 10 * intBooksRead
ElseIf (intBooksRead > 3) And (intBooksRead <= 6) Then
intBonusPoint = ((intBooksRead - 3) * 15) + 3 * 10
ElseIf (intBooksRead > 6) Then
intBonusPoint = ((intBooksRead - 6) * 20) + 3 * 10 + 3 * 15
End If
lblBonusPoint.Text = intBonusPoint
End Sub
Private Sub cmdTotalBookRead_Click()
intBooksRead = txtBooksRead.Text
30

VISUAL PROGRAMMING (CBVP2103)


intTotalBooksRead = intTotalBooksRead + intBooksRead
txtTotalBooksRead.Text = intTotalBooksRead
End Sub
Private Sub cmdTotalName_Click()
Dim WordCount As Integer
Dim ChrCount As Integer
For ChrCount = 1 To Len(txtName.Text)
If Mid(txtName.Text, ChrCount, 1) = " " Then GoTo skip_Count ' just don't count when a
space is met
If ChrCount <> 1 Then 'to check if the cursor is in the first char then check for space
If Mid(txtName.Text, ChrCount - 1, 1) = " " Then 'just counts when a previous char is a
space
WordCount = WordCount + 1
End If
Else
WordCount = WordCount + 1 'counts initially if first char is not equal to space
End If
skip_Count:
Next
txtTotalName.Text = WordCount
End Sub

Private Sub cmdAverage_Click()


'Average Books Read

31

VISUAL PROGRAMMING (CBVP2103)


intAverageBooksRead = intTotalBooksRead / 3
txtAverageBooksRead.Text = intAverageBooksRead
End Sub
Private Sub mnuEditClear_Click()
txtName.Text = ""
txtBooksRead.Text = ""
lblBonusPoint.Text = ""
txtTotalBooksRead = ""
txtTotalName = ""
txtAverageBooksRead = ""
txtName.SetFocus
End Sub
Private Sub mnuEditColor_Click()
With dlgCommon
.Flags = cdlCCRGBInit

'Set up initial Color

.Color = lblBonusPoint.ForeColor
.ShowColor
lblBonusPoint.ForeColor = .Color
End With
End Sub
Private Sub mnuEditFont_Click()
'Change the font name
With dlgCommon
.Flags = cdlCFScreenFonts
.ShowFont
lblBonusPoint.Font.Name = .FontName
End With
End Sub
32

VISUAL PROGRAMMING (CBVP2103)


Private Sub mnuFileExit_Click()
'Terminate the project
End
End Sub
Private Sub mnuFilePoints_Click()
If txtBooksRead.Text = "" Then
MsgBox ("Please Enter The No Of Book's Read")
Else
cmdCulculate_Click
End If
End Sub
Private Sub mnuFileSummary_Click()
If txtBooksRead.Text = "" Then
MsgBox ("Please Enter The No Of Book's Read")
Else
cmdAverage_Click
End If
End Sub
Private Sub mnuHelpAbout_Click()
MsgBox "Open university Malaysia Kelantan" & vbCrLf & vbCrLf & "Programmed by
Hasmaliza Hamzah" & vbCrLf & vbCrLf & "Bachelor's Degree in Multimedia
Communication", vbOKOnly, "About My Application"
End Sub

ATTACHMENT
33

VISUAL PROGRAMMING (CBVP2103)


REFERENCES
Zainuddin, Zulkarnain,Faidzul (2010).Visual Programming, (4th Edition) Sri Kembangan:
Open University Malaysia

34

You might also like