Practical Work 1 Jun2014

download Practical Work 1 Jun2014

of 5

Transcript of Practical Work 1 Jun2014

  • 8/11/2019 Practical Work 1 Jun2014

    1/5

    Page 1of 5

    ELECTRICAL ENGINEERING DEPARTMENTJUN 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 passivesentences) 5%

    Result:Programme Code and Interface

    15%

    Discussion:Answer given questions

    5%

    Conclusions:Based on overall practical work

    5%

    TOTAL %

  • 8/11/2019 Practical Work 1 Jun2014

    2/5

    Page 2of 5

    Appendix AEC502: Visual Basic Programming

    Name: Class:Registration Number: Date:

    Practical Skill Assessment Rubric

    Marks:

    ItemSteps Average

    /101 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 ACHIEVEDNOT YET

    COMPETENTCOMPETENT HIGHLY

    COMPETENTOUTSTANDING

    1 2 3 4 5

    A. AnaliticalUnable toanalyze givenproblem

    Able to analyzegiven problem

    B. NamingControls

    All controls areincorrectlylabelled.

    Partially controlsare not labelled.

    . All controls arelabelled usingreadable font.

    C. Layout

    No planning inthe layout wasdone. Formlooks cluttered.

    Partially controlsare out of place

    Controls areorganized andpositionedaccording to thefunction of theprogram.

    D. Design/Appearance

    No attempt isdone to improvethe appearanceof the form.

    .

    Backgroundcolor, foregroundcolor, pictures,text styles, etc.add appeal to theform.

    Background color,foreground color,pictures, text styles,etc. enhance theappearance of theform.

    E. ProgramWriting

    Unable to writeVB Codes for theassigned events.

    Partially able towrite VB codesfor the assignedevents

    .Able to write VBcodes for theassigned events

    F. Testing 6 or more errors 3-5 errorsFree of errors (e.g.run-time and logicalerrors)

    G. WorkAttitude

    Lecturer or

    classmateassisted all

    throughout theactivity.

    Works with

    moderateteacher orclassmateassistance.

    Works

    Independently. Noassistance from theteacher orclassmate is given.

  • 8/11/2019 Practical Work 1 Jun2014

    3/5

    Page 3of 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 program3. 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) andalso as a user interface concepts and interface design of objects control or components in visualbasic 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 numberas 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.

  • 8/11/2019 Practical Work 1 Jun2014

    4/5

    Page 4of 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 : frmHelloFormMethod Name (Event Handler) : LoadTextBox1.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 TextBox1Text: FONT

    Class Name : btnFontMethod Name (Event Handler): ClickSelect also FontDialog from the ToolBox and drag onto the Form Windows.Enter the code:

    FontDialog1.ShowColor = TrueFontDialog1.Font = TextBox1.FontFontDialog1.Color = TextBox1.ForeColor

    If FontDialog1.ShowDialog() System.Windows.Forms.DialogResult.Cancel ThenTextBox1.Font = FontDialog1.FontTextBox1.ForeColor = FontDialog1.Color

    End If

    Button2 : Insert Message and text into TextBox1 by using InputBox.Text: TEXTClass Name : btnTextBoxMethod 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 dispalyedin TextBox1.

  • 8/11/2019 Practical Work 1 Jun2014

    5/5

    Page 5of 5

    iv.

    v.

    Button3 : To add three items in ComboBox with "Pahang Darul Makmur","Terengganu DarulIman" and "Melaka Bandaraya Bersejarah"Text: COMBOClass Name : btnAddComboMethod 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 ListBoxClass Name : tnClearMethod 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.YesNoDim Icons As MessageBoxIcon = MessageBoxIcon.QuestionDim Result As DialogResult

    'Displays the MessageBoxResult = 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 numberwill be displayed in a textbox. Make up objects or components with properties in the propertieswindow.

    2. Drag and a List Box control and add three items with your friends names. When a ListBoxItemis selected, the name will be displayed on a Message Box.

    DISCUSSIONS 1. State the properties of each control used in Step 4.

    ASSESSMENT1. Show the output of the program to your lecturer2. Write overall conclusions on this practical work.