Sei sulla pagina 1di 5

Page 1 of 5

ELECTRICAL ENGINEERING DEPARTMENT


JUN 2014
EC502 VISUAL BASIC PROGRAMMING
PRACTICAL WORK : 1. INTRODUCTION TO VISUAL BASIC 2010 ENVIRONMENT
PRACTICAL WORK DATE :
LECTURERS NAME:
STUDENT ID: NAME: SECTION :







MARK SCHEME:
Practical skill Refer appendix A 70%
Report
Format:
(Layout + using passive
sentences)
5%
Result:
Programme Code and Interface
15%

Discussion:
Answer given questions
5%
Conclusions:
Based on overall practical work
5%


TOTAL

%





Page 2 of 5

Appendix A
EC502: Visual Basic Programming

Name: Class:
Registration Number: Date:

Practical Skill Assessment Rubric


Marks:
Item
Steps
Average
/10
1 2 3 4
A /5 /5 /5 /5 /10
B /5 /5 /5 /5 /10
C /5 /5 /5 /5 /10
D /5 /5 /5 /5 /10
E - /5 /5 /5 /10
F /5 /5 /5 /5 /10
G /5 /5 /5 /5 /10
Total: /70




NOT ACHIEVED
NOT YET
COMPETENT
COMPETENT

HIGHLY
COMPETENT
OUTSTANDING
1 2 3 4 5
A. Analitical
Unable to
analyze given
problem

Able to analyze
given problem
B. Naming
Controls
All controls are
incorrectly
labelled.

Partially controls
are not labelled.
. All controls are
labelled using
readable font.
C. Layout
No planning in
the layout was
done. Form
looks cluttered.

Partially controls
are out of place
Controls are
organized and
positioned
according to the
function of the
program.
D. Design/
Appearance
No attempt is
done to improve
the appearance
of the form.
.
Background
color, foreground
color, pictures,
text styles, etc.
add appeal to the
form.
Background color,
foreground color,
pictures, text styles,
etc. enhance the
appearance of the
form.
E. Program
Writing
Unable to write
VB Codes for the
assigned events.
Partially able to
write VB codes
for the assigned
events
.
Able to write VB
codes for the
assigned events
F. Testing 6 or more errors 3-5 errors

Free of errors (e.g.
run-time and logical
errors)
G. Work
Attitude
Lecturer or
classmate
assisted all
throughout the
activity.
Works with
moderate
teacher or
classmate
assistance.
Works
Independently. No
assistance from the
teacher or
classmate is given.
Page 3 of 5

TITLE: INTRODUCTION TO VISUAL BASIC PROGRAMMING ENVIRONMENT
OBJECTIVES:

1. To introduce students with the Visual Basic programming environment.
2. To write, compile and run a sample Visual Basic program
3. To debug and run error trapping on a given program sample.

COURSE LEARNING OUTCOMES (CLO)

Upon completion of this course, students should be able to:
3. perform visual basic application and errors solving using debugging and error trapping techniques within a
stipulated time frame based on given tasks. (P4)

THEORY PRE-
REQUISITE:

Introduction to Visual Basic Programming.

To create a project with Visual Basic Integrated Development Environment application (IDE) and
also as a user interface concepts and interface design of objects control or components in visual
basic includes:
1) User Interface Design using ToolBox controls and control properties setting.
a. TextBox, Buttons, ComboBox and ListBox.
b. Dialog Boxes in Application.
c. Message-Box and Input-Box.
d. List Boxes and Combo Boxes
2) Program coding by using Code Window (Forms or modules).
3) To run the debugging process, compile and run Visual Basic programs.

EQUIPMENTS: 1. PC with Visual Basic 2010

STEP 1:


















This is simple guide on how to compile a program using Microsoft Visual Basic 2010 Express.

Begin Here:
1. Create a new folder with registration number as a new folder name on desktop.
2. Start-up Microsoft Visual Basic 2010 (Start -> Microsoft Visual Studio 2010 Express -> Microsoft
Visual Basic 2010 Express)
3. Click New Project, select Windows Form Application and click OK.
4. You are now in the Visual Basic Integrated Development Environment (IDE).
5. Identify the Menu Bar, Toolbars and Toolbox.
6. Identify the Project Explorer Window, Properties Window, Error List Window and Immediate
Window.
7. Set the Text Property of the form to My First VB 2010 Project.
8. Design the form with the controls as below. Use a Textbox, a Label, three Buttons and in Picture
Box. Set Suitable Properties for each control to get the similar appearance on the form.
9. Press F5 or Run the program. Observe the output.
10. Save the program by Selecting Menu File -> save All (Ctrl + Shift + S). Browse to the folder
prepared earlier. Name the project Lab1_S1 and click Save.

Page 4 of 5


Figure 1: VB Form

STEP 2

i.










ii.















iii.







Create a new project an rename as Lab1_Step2 and write a Visual Basic program based on Class
name and Method Name givem below:

Form:
Class Name : frmHelloForm
Method Name (Event Handler) : Load
TextBox1.Text = "Welcome to Visual Basic"
TextBox1.Font = New System.Drawing.Font("Arial", 16)
TextBox1.Font = New System.Drawing.Font(TextBox1.Font, FontStyle.Bold Or FontStyle.Italic)
TextBox1.ForeColor = Color.RoyalBlue


Button1 : To Show Font Dialog properties and change properties at TextBox1
Text: FONT
Class Name : btnFont
Method Name (Event Handler): Click
Select also FontDialog from the ToolBox and drag onto the Form Windows.
Enter the code:
FontDialog1.ShowColor = True
FontDialog1.Font = TextBox1.Font
FontDialog1.Color = TextBox1.ForeColor

If FontDialog1.ShowDialog() <> System.Windows.Forms.DialogResult.Cancel Then
TextBox1.Font = FontDialog1.Font
TextBox1.ForeColor = FontDialog1.Color
End If


Button2 : Insert Message and text into TextBox1 by using InputBox.
Text: TEXT
Class Name : btnTextBox
Method Name (Event Handler): Click

Create a variable of string data type. Assign it with the input from the InputBox control object.
The result is to be displayed by the codes with MessageBox. Then the input string is dispalyed
in TextBox1.

Page 5 of 5



iv.









v.





Button3 : To add three items in ComboBox with "Pahang Darul Makmur","Terengganu Darul
Iman" and "Melaka Bandaraya Bersejarah"
Text: COMBO
Class Name : btnAddCombo
Method Name (Event Handler): Click

ComboBox : To display list of states and display SelectedItem via MessageBox.
Class Name : ComboState
Method Name (Event Handler): Click


Button4 : To clear items of ComboBox and ListBox
Class Name : tnClear
Method Name (Event Handler): Click



STEP 3

a) Message Box application:
i. Crete a new project form with a Button control.
ii. Retype of the codes below and observe the output.
iii. Add two more button and change to different Message, Caption, MessageBoxButtons and
MessageBoxIcon referring to their own function.

Dim Message As String = "Do you want to close this project?"
Dim Caption As String = "Question ?"
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Icons As MessageBoxIcon = MessageBoxIcon.Question
Dim Result As DialogResult

'Displays the MessageBox
Result = MessageBox.Show(Message, Caption, Buttons, Icons)
' Gets the result of the MessageBox display.

If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If


STEP 4

1. Create a new Windows Application when a button clicked, your Name and Registration number
will be displayed in a textbox. Make up objects or components with properties in the properties
window.
2. Drag and a List Box control and add three items with your friends names. When a ListBoxItem
is selected, the name will be displayed on a Message Box.

DISCUSSIONS 1. State the properties of each control used in Step 4.
ASSESSMENT
1. Show the output of the program to your lecturer
2. Write overall conclusions on this practical work.

Potrebbero piacerti anche