Download presentation
Presentation is loading. Please wait.
Published byWinfred Brooks Modified over 9 years ago
1
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java
2
Created by Alia Al-Abdulkarim 2008 Variables Dim a As Double = 3.0 Dim b As Double = 4.0
3
Created by Alia Al-Abdulkarim 2008 Loops While Loop While (i <> limit) sum += i i+=1 End While
4
Created by Alia Al-Abdulkarim 2008 Loops cont. For Loop For i = 1 To 5 Step 1 ---- Next
5
Created by Alia Al-Abdulkarim 2008 Select Case Select Case (choice) Case 1 ----- Case 2 ----- Case 3 ----- Case Else ----- End Select
6
Created by Alia Al-Abdulkarim 2008 Visual Basic Visual Basic Functions and Subs Scopes Events
7
Created by Alia Al-Abdulkarim 2008 Functions and Subs Function Piece of code that is executed upon a function call. Always returns a value May receive parameters Sub Same as function, but it doesn’t return a value
8
Created by Alia Al-Abdulkarim 2008 Functions and Subs cont. Function function-name (ByVal Para1 As data-type, ……..) As data-type -------- Return variable End Function
9
Created by Alia Al-Abdulkarim 2008 Functions and Subs Cont. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Function function-name (ByVal Para1 As data-type, ……..) As data-type -------- Return variable End Function End Sub Functions’ Definitions Can Not Be Nested
10
Created by Alia Al-Abdulkarim 2008 Scopes Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim A As Integer End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click A = 10 End Sub Variable Declaration isn’t visible here
11
Created by Alia Al-Abdulkarim 2008 Events When do we use them? Example When I want the value in the textbox printed on a label after the button is clicked, I create an Event that reads from the textbox and writes on a label Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim var As String var = TextBox1.Text Label1.Text = var End Sub
12
Created by Alia Al-Abdulkarim 2008 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim a As Integer = 0 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = a End Sub Quiz: What is the Problem? Variable Declaration isn’t visible here
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.