Visual Basic Visual Basic

Size: px
Start display at page:

Download "Visual Basic Visual Basic"

Transcription

1 Visual Basic Visual Basic

2 2 II 9-1 GoTo xbqj/xbqj_12.htm structured programming a goto b c goto d b goto e d goto a a End a a e b b goto c End b

3 9 3 top-down programming programming modulized ~ ~ ~ ~ ~ ~

4 4 II module n 50

5 9 5 cohesion coupling 50

6 6 II 10 A A A A' B B F F ( )1. ( )2. (A) (B) (C) (D) (A) (B) (C) (D) GoTo ( )3. (A) (B) (C) (D)

7 GoTo GoTo F T F T GoTo

8 8 II GoTo 9-6 GoTo GoTo 9-6 GoTo GoTo : a = 1 line:print a a = a + 1 if a <=10 Then GoTo line Print "end" GoTo GoTo ( )1. (A) (B) (C) (D) ( )2. (A) (B) (C) (D) GoTo ( )3. (A) (B) (C) (D) CPU ( )4. Visual Basic Loop (D)Select Case (A)GoTo (B)MsgBox (C)Do

9 Visual Basic subprogram user-defined function vb1/vb2_13.doc Sub call Call. A Sub. A Sub [( 1 [As ], 2 [As ], )]

10 10 II Call [( 1, 2, )] Visual Basic 1. Visual Basic 2. Sub formal parameters Call actual parameters 3. Call Call 1 1 N Sub N_Sum(a As Integer) 'a Dim sum As Integer, i As Integer sum = 0 For i = 1 To a sum = sum + i Next i MsgBox " " & a & " = " & sum,, " 1 N " Private Sub Form_Activate( ) Dim N As Integer N = InputBox(" N ", " ") Call N_Sum(N) 'N "Ch09-2a.vbp"

11 Call N = 5 N_Sum( ) 2. N_Sum( ) 1 sum 1 2 sum 2 3 sum 3 3. MsgBox sum 1 N 2 Sub Change_temp(F As Integer) 'F Dim C As Integer C = (F - 32) * 5 / 9 MsgBox " " & F & " = " & C & " ",, " " Private Sub Form_Activate( ) Dim F_temp As Integer F_temp = InputBox(" ", " ") Call Change_temp(F_temp) 'F_temp "Ch09-2b.vbp"

12 12 II Call F_temp = 76 Change_temp( ) 2. Change_temp( ) = ( - 32) * 5 / 9 3. MsgBox C 3 Sub Cal_sw(S_sex As String, S_ht As Single) 'S_sex S_ht Dim sw As Single If S_sex = "M" Then ' sw = (S_ht - 80) * 0.7 ElseIf S_sex = "F" Then ' sw = (S_ht - 70) * 0.6 End If MsgBox " " & sw,, " " Private Sub Form_Activate( ) Dim ht As Single, sex As String * 1 sex = InputBox(" M F", " ") ht = InputBox(" (cm) ", " ") Call Cal_sw(sex, ht) 'sex ht "Ch09-2c.vbp"

13 Call sex ht = M 176 Cal_sw( ) 2. Cal_sw( ) If-ElseIf 3. MsgBox 4. Sub Cal_sw(S_sex As String, S_ht As Single) 's h Dim sw As Single, swt As Single If S_sex = "M" Then ' End If MsgBox " " & sw,, " " swt = InputBox(" (kg)", " ") If swt > sw Then MsgBox " ",, " " Else MsgBox " ",, " " End If

14 14 II 1. = * 9 / Sub Change_temp(C As Integer) Dim F As Integer F = Print " " & C & " = " & F & " " Private Sub Form_Activate( ) Dim X As Integer X = InputBox(" ", " ") Call Sub Check_Id(S_id As String) Dim sex As Integer sex = Int(Mid(S_id, 2, 1)) If Then Print " " ElseIf Then Print " " End If Private Sub Form_Activate( ) Dim id As String id = InputBox(" ", " ") Call

15 9 15 = A B C A B C

16 16 II Step Form1 Caption Command1(0) Caption A Command1(1) Caption B Command1(2) Caption C Command1(3) Caption A Command1(4) Caption B Command1(5) Caption C Label1 Caption Label2 Alignment 2 Label2 BackColor &H & Label2 BorderStyle 1 Label2 Caption Label3 Caption Label3 ForeColor &H00FF0000&

17 9 17 Step2 1. InputBox( ) 2. cal_price( ) cal_price( ) cal_price( ) click

18 18 II 9-14 cal_price( ) i j i 0, 2 1 3, 5 4 A/C = B = A/C = B = price = * 2.5 price = * 3 price = * 1.5 price = * 2 price * j Command1_Click

19 9 19 Step3 1. A Command1(0) Command1_Click Private Sub Command1_Click(Index As Integer) Dim count As Integer count = InputBox(" ", " ") Call cal_price(index, count) 'Index count 10~20 30~30 cal_price( ) Index count 2. cal_price( ) Sub cal_price(i As Integer, j As Integer) Dim price As Integer, sum As Integer Dim area As String price = 600 Select Case i Case 0, 2 area = " A/C " price = price * 2.5 Case 1 area = " B " price = price * 3 Case 3, 5 area = " A/C " price = price * 1.5 '

20 20 II Case 4 area = " B " price = price * 2 End Select sum = j * price Label3.Caption = j & " " & area & " " & sum & " " 40~60 price 70~80 Select Case area 90~100 = * 10 9 cal_price( ) If-Then-Else

21 9 21 ( )1. (A) (B) (C) (D) ( )2. Visual Basic (A)0 (B)512 (C)-1024 (D)1024 Sub SUM(X As Integer, Y As Integer) TOTAL = -X ^ Y Print TOTAL Private Sub Form_Activate( ) Call SUM(2, 10) ( )3. 1 TOTAL = -X ^ Y TOTAL = X ^ 2 * (-Y) (A)-40 (B)40 (C)-200 (D)200 ( )4. Visual Basic (A) x (B)( x) 2 (C) x 2 (D)1 x + 2 x + 3 x + + x x Sub Cal(x As Integer) Dim sum As Long, i As Integer sum = 0 For i = 1 To x sum = sum + i ^ 2 Next i Print sum ( )5. 3 Cal( ) (A)14 (B)15 (C)16 (D)36

22 22 II 1. (1) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (2) InputBox( ) (3) Left( ) Select Case (4) MsgBox "Sp09- a.frm" "Sp09-a.vbp"

23 Visual Basic user-defined function built-in function Visual Basic 2-2 Int( ) Str( ) Function Function End V V = A( ). Function End Function A( ) As Integer. A( ) = 100 Function [( 1 [As ], 2 [As ], )] As End Function =

24 24 II = [( 1, 2, )] 1. Visual Basic 2. Function 3. Function 1 1 N Function N_Sum(a As Integer) As Integer Dim sum As Integer, i As Integer sum = 0 For i = 1 To a Step 2 sum = sum + i Next i N_Sum = sum End Function 'a Private Sub Form_Activate( ) Dim N As Integer, total As Integer N = InputBox(" N ", " ") total = N_Sum(N) 'N MsgBox " " & N & " = " & total,, " 1 N " "Ch09-2d.vbp"

25 N_Sum( ) N = 10 N_Sum( ) 2. N_Sum( ) 1 sum 1 2 sum 3 3 sum 5 3. sum 1 N sum total 2 Function Cal_Circle(r As Single) As Single Const pi = Cal_Circle = r ^ 2 * pi End Function 'r Private Sub Form_Activate( ) Dim X As Single Dim area As Single X = InputBox(" ", " ") area = Cal_Circle(X) 'X MsgBox " " & X & " = " & area,, " " "Ch09-2b.vbp" "Ch09-2e.vbp"

26 26 II Cal_Circle( ) X = 10 Cal_Circle( ) 2. Cal_Circle( ) 3 Function Blood_Type(blood As String) As String Select Case blood Case "OO": Blood_Type = "O " Case "OA", "AO": Blood_Type = "O A " Case "OB", "BO": Blood_Type = "O B " Case "OAB", "ABO": Blood_Type = "A B " Case "AA": Blood_Type = "A O " Case "AB", "BA": Blood_Type = "A B O AB " Case "AAB", "ABA": Blood_Type = "A B AB " Case "BB": Blood_Type = "O B " Case "BAB", "ABB": Blood_Type = "A B AB " Case "ABAB": Blood_Type = "A B AB " End Select End Function Private Sub Form_Activate( ) Dim parent_blood As String Dim u_blood As String

27 9 27 parent_blood = InputBox(" :OO _ O ", " ") u_blood = Blood_Type(parent_blood) MsgBox " " & u_blood,, " " "Ch09-2f.vbp" Blood_Type( ) parent_ blood Blood_Type( ) 2. Blood_Type( ) Select Case O A B AB O O v O A v v O B v v O AB v v A A v v A B v v v v A AB v v v B B v v B AB v v v AB AB v v v

28 28 II 1. Function Cal_Cycle(r As Single) As Const pi = Cal_Cycle = 2 * pi * r End Function Private Sub Form_Activate( ) Dim x As Single, p As Single x = InputBox(" ", " ") MsgBox " " & x & " = " & p 2. Function Cal_Rnd(lower As Integer, upper As Integer) As Cal_Rnd = Int(Rnd * (upper - lower + 1)) + lower End Function Private Sub Form_Activate( ) Dim n1 As Integer, n2 As Integer Dim n As Integer n1 = InputBox(" ", " ") n2 = InputBox(" ", " ") Print n

29 Step

30 30 II Form1 Caption Command1 Caption Combo1 Text Image1 Picture.jpg Image1 Stretch True Label1 Caption Label2 Caption Label3 Caption Label4 Caption Text1 Text Step AddItem Combo1 2. Mbill( ) 3. Mbill( ) Select Case If-Then-Else Mbill( ) bill Click

31 Mbill( ) F_sec F_case F_case = 0.13 = 88 = 0.12 = 188 = 0.11 = 288 = 0.09 = 588 rate * F_sec T < F Command1_Click

32 32 II Step3 1. Form_Load 10~40 2. Command1_Click 50~ Private Sub Form_Load( ) Combo1.AddItem " 88 " Combo1.AddItem " 188 " Combo1.AddItem " 288 " Combo1.AddItem " 588 " Private Sub Command1_Click( ) Dim bcase As Integer, sec As Integer Dim bill As Integer bcase = Combo1.ListIndex 'bcase sec = Int(Text1.Text) * 60 'sec bill = Mbill(bcase, sec) Label4.Caption = " " & bill & " " 10~40 Combo1 50~80 Combo1 bcase 60 sec 90~90 Mbill( ) bcase sec bill 100~100 Label4 Caption

33 Mbill( ) Function Mbill(F_case As Integer, F_sec As Integer) As Integer Dim rate As Single, fee As Integer Dim total As Integer Select Case F_case ' Case 0 rate = 0.13 fee = 88 Case 1 rate = 0.12 fee = 188 Case 2 rate = 0.11 fee = 288 Case 3 rate = 0.09 fee = 588 End Select total = rate * F_sec ' = If total < fee Then Mbill = fee Else Mbill = total End If End Function 110~140 Select Case 150~200 If-Then-Else (1) (2) MsgBox 288/0.11/60 43

34 34 II ( )1. (A) 1 N (B) 1 N (C) 2 N (D) N! Sub Calculate(N As Integer) Dim i As Integer Dim power As Long power = 1 For i = 1 To N power = power * 2 Next i ( )2. Visual Basic (A)-2 (B)-1 (C)0 (D)1 Sub test (m As Integer) m = m ^ (m + 2) Private Sub Form_Activate( ) Dim C As Integer C = -2 Call test(c) Print C ( )3. Visual Basic FNA(4,18) (A) 9 (B)10 (C)16 (D)32 Sub FNA(X As Integer, Y As Integer) ANS = (X ^ 2 + Y Mod 7) / 2 Print ANS

35 "Ex09-b.vbp" (1) / (2) Select Case (3) "Sp09-b.vbp" ntu.edu.tw/course/ vb/.files/ frame.htm VB pass by value Visual Basic Visual Basic pass by reference

36 36 II Visual Basic Visual Basic 9-23 "ByRef" a 25 a Click Private Sub Command1_Click( ) 10 Dim a As Single 20 a = Text1.Text 30 Label1.Caption = a 40 Call cal(a) 50 Label4.Caption = a a "Ch09-2g.vbp" a (5) Sub cal(byref x As Single) 60 Label2.Caption = x 70 x = x ^ 2 80 Label3.Caption = x a x 0006

37 salary = grade = 80 Sub Raise(ByRef s As Integer, g As Integer) Select Case g Case 85 To 100: s = s * 1.10 Case 75 To 84: s = s * 1.05 Case Is <= 60: s = s * 0.95 End Select Private Sub Form_Activate( ) Dim salary As Integer, grade As Integer salary = InputBox(" ", " ") grade = InputBox(" ", " ") Call Raise(salary, grade) Print salary 2. salary = sale = Sub Income(ByRef s1 As Integer, s2 As Integer) As Integer Select Case s2 Case Is >= 10000: s1 = s1 + s2 * Case Is >= 6500: s1 = s1 + s2 * Case Else: s1 = s1 + s2 * 0.02 End Select End Function Private Sub Form_Activate( ) Dim salary As Integer, sale As Integer salary = InputBox(" ", " ") sale = InputBox(" ", " ") Call Income(salary, sale) Print salary

38 38 II Visual Basic "ByVal" Call cal((a)) 9-24 a 5 a Click Private Sub Command1_Click( ) 10 Dim a As Single 20 a = Text1.Text 30 Label1.Caption = a 40 Call cal(a) 50 Label4.Caption = a a 5 x "Ch09-2h.vbp" 3 50 x 25 Sub cal(byval x As Single) 60 Label2.Caption = x 70 x = x ^ 2 80 Label3.Caption = x A 000B a x

39 kg = 6 Sub Conversion(ByVal S_kg As Integer) S_kg = S_kg * 10 / 6 Print S_kg & " ", Private Sub Form_Activate( ) Dim kg As Integer kg = InputBox(" ", " / ") Call Conversion(kg) Print " " & kg & " " 2. n n = 5 Sub N_sum(ByVal An As Integer) Const a1 = 5 'a1 Const d = 2 'd An = a1 + (An - 1) * d 'A n n Print An, Private Sub Form_Activate( ) Dim n As Integer n = InputBox(" n ", " An") Call N_sum(n) Print "n = " & n

40 40 II ByRef ByVal Visual Basic 1 Call Sort(N( )) ' N( ) 2 Call Sort(N(5)) ' N(5) Call Sort((N(3))) ' N(3)

41 9 41 ( )1. Visual Basic (A) x y z a b (B) x y a b (C) a b x y (D) a b x y z Sub test(byref x As Integer, y As Integer) Const z = 2 x = x Mod 3 + y * z 'ByRef Private Sub Form_Activate( ) Dim a As Integer, b As Integer a = 15: b = 6 Call test(a, b) Print a * b ( )2. (A)36 (B)54 (C)72 (D)90 1. Sub Cal_bonus( x As Integer, ByVal y As Integer) x = x + y / 20 MsgBox " " & x & " " Private Form_Activate( ) Dim bonus As Integer, bill As Integer bonus = InputBox(" ") bill = InputBox(" ") Call Cal_bonus(bonus, bill) Select Case bonus '.

42 42 II ( )1. Visual Basic (A) (B) 2 (C) (D) Call ( )2. Visual Basic Test(9) (A)139 (B) 123 (C)45 (D)13 Function Test(n As Integer) As Integer Dim i As Integer For i = 1 To n If n Mod i = 0 Then Print i Next i End Function ( )3. Visual Basic (A)24 (B)20 (C)16 (D)12 Sub Fact(ByVal x As Integer) Dim i As Integer, k As Integer k = 1 For i = 1 To x k = k * i Next i Print k 'ByVal Private Sub Form_Activate( ) Dim a As Integer a = 4 Call Fact(a)

43 9 43 ( )4. VB a (A)-1 (B)0 (C)1 (D)2 Sub Good(s As Integer) s = s + 1 Sub Bad(ByVal t As Integer) t = t - 2 Private Sub Form_Activate( ) Dim a As Integer a = 0 Call Good(a) Call Bad(a) Print a ( )5. T (A)40 (B)30 (C)20 (D)10 Function FNP(X) As Long FNP = X * X + X End Function Private Sub Form_Activate( ) Dim K As Integer, T As Integer For K = 1 To 4 T = T + FNP(K) Next K Print T

44 44 II 9-3 Visual Basic Visual Basic project Visual Basic Visual Basic 9-25 Visual Basic Visual Basic "Form" *.frm Form1. frm Visual Basic

45 method Show Visual Basic Hide "Ex09-3a2.frm" Form1 1 Step "Ex09-3a.vbp" 2 Step /

46 46 II Step 3 4 Step "Ex" frm" "Ex09-3a2. Step 5 6 Step "Form2(Ex09-3a2.frm)" Form2 7 Step Command1_Click Step 8 9 Step "Sp09-3a1.frm" "Sp09-3a2.frm" "Sp09-3a.vbp" end

47 9 47 "Sp09-3a.vbp" 9-27 / *.bas Module1.bas "Module" 9-27

48 48 II Visual Basic Main 9-28 /Project1 Project1 Visual Basic Visual Basic "Class" *.cls Class1.cls ( )1. (D)4 (A)1 (B)2 (C)3 ( )2. (A)1 (B)2 (C)3 (D)4 ( )3. Visual Basic (A) *. frm (B) (C) *.cls (D)

49 Visual Basic procedure Visual Basic "Private" Cyl( ) 9-29 Form_Activate 9-29 Public Sub Cir( r As Single) Dim area As Single Const pi = Cir( ) Form_Activate( ) Private Sub Form_Activate( ) Dim a As Integer. Cyl( ) Activate( ) Form_ Call Cir(a) Call Cyl(a). Private Sub Cyl( r As Integer) Dim leng As Single. Form1 Module1

50 50 II Visual Basic "Public" power( ) Public Sub power(n As Integer) ' 2 N Dim a As Integer. Print a Private Sub Form_Activate( ) Call power(5) Visual Basic 9-31( ) ( ) Command1_Click 9-31( ) Show1( ) Show2

51 Public Sub Show1( ) Label1(0).Caption = "F" 1 Private Sub Show2( ) Label1(1).Caption = "F" Private Sub Command1_Click( ) Call Show1 Call Show2 Call Module1.Show1 Call Module1.Show Public Sub Show1( ) Form1.Label1(2).Caption = "M" Private Sub show2( ) Form1.Label1(3).Caption = "M" Form1 Module1 Command1_Click Private Command1_ Click Show2( ) "Ch09-3a.vbp"

52 52 II ( )1. (B)Const (C)Public (D)Private Sub (A)Dim ( )2. Visual Basic Form1 (A)0 (B)1 (C)2 (D)3 Public Function Add(x As Integer, y As Integer) As Long Add = x + y End Function Private Function Subs(x As Integer, y As Integer) As Integer Subs = x - y End Function Private Sub Command1_Click(Index As Integer) Dim a As Integer Dim b As Integer a = Int(Text1.Text) b = Int(Text2.Text) If Index = 0 Then ' (+) Call Add(a, b) ElseIf Index = 1 Then ' (-) Call Subs(a, b) End If ( )3. (A) Add( ) (B) Subs( ) (C) Command1_Click (D)

53 9 53 ( )1. Visual Basic (A) (B) (C) (D) ( )2. (A) (B) (C) (D) ( )3. (A) (D) (B) *.cls (C) Module ( )4. Visual Basic (A)Sub (B)Public (C)Private (D)End ( )5. Visual Basic Form1 Module1 Share( ) Form_Click Share( ) (A)Call Share (B) Call Module1 (C)Call Form1.Share (D)Call Module1.Share ( )6. Form_Click Share( ) (A)Call Share (B)Call Form1 (C)Call Module1 (D) Call Module1.Share ( )7. Visual Basic (A)Big (B)Small (C)Equal (D) ' Form1 ' Module1 Private Sub Form_Activate( ) Private Sub test(x%, y%) Dim a As Integer If (x - y) > 0 Then Dim b As Integer Form1.Print "Big" a = 10 ElseIf (x - y) < 0 Then b = 6 Form1.Print "Small" Call Module1.test(a, b) Else Form1.Print "Equal" End If

54 54 II 9-4 Visual Basic Dim Private Public scope Visual Basic global variable local variable "Public" Public As Public grade As Integer

55 fgv mgv mp( ) fgv Form1 fgv mgv Form1 Module Module1 Public mgv As Integer mgv fgv Sub mp( ) Form_Activate mgv = mgv + 1 Form1.fgv = Form1.fgv Form1.Print mgv; Form1.fgv Form1 Public fgv As Integer Private Sub Form_Activate( ) fgv = 1 1 mgv = 2 2 Call mp mgv = mgv fgv = fgv Print mgv; fgv Print Print "Ch09-4a.vbp"

56 56 II Private flv flv Private sub fp( ) Dim f f End sub Private Dim As As 1 2 Private zipcode As String Dim tel As String "Private" "Dim" Dim As Dim sex As Boolean

57 flv mlv mlv flv 9-34 Module1 Dim mlv As Integer mlv flv Form_Activate Sub mp( ) Dim flv As Integer mlv = mlv + 1 flv = flv + 1 Form1.Print mlv; flv Form1 Dim flv As Integer mtv flv Private Sub Form_Activate( ) Dim mlv As Integer flv = 1 mlv = 2 Call mp mlv = mlv + 1 flv = flv + 1 Print mlv; flv Print Print "Ch09-4b.vbp"

58 58 II Option Explicit Visual Basic Option Explicit Dim Private Public ReDim Static / j

59 9 59 ( )1. Visual Basic (C) (D) (A) (B) ( )2. Visual Basic (A)5 8 (B)5 3 (C)3 5 (D)8 5 ' Form1 Private Sub form_activate( ) Dim i As Integer i = i + 5 Print i; Call Test ' Module1 Dim i As Integer Public Sub Test( ) Dim j As Integer j = 3: i = i + j Form1.Print i 1. Visual Basic (1) (2) Print ' Form1 Private Sub form_activate( ) Dim a As Integer, b As Integer, c As Integer a = 3 b = 2 c = a + b Call power(a, b) Print c ' Module1 Dim c As Long Sub power(x As Integer, y As Integer) Dim k As Integer k = 10 c = x + y * (k - 1) Form1.Print c

60 60 II Visual Basic life time Public x As Integer Sub add( ) x Sub min( ) 9-37 y 9-37 z

61 Public x As Integer Private y As Date Sub add( ) Dim z As String z y Sub min( ) 9-37 add( ) z static variable Timer Static Static sub xxx( ) Static As 9-38 Timer1_Timer d s Timer1_Timer

62 62 II d 0 s s Private Sub Timer1_Timer( ) Dim d As Integer Static s As Integer Print Print "d = " & d, "s = " & s d = d + 1 s = s + 1 Print "d = " & d, "s = " & s Print 'd 's ' 9-39 Timer1_Timer 1 Timer1_Timer 2 Timer1_Timer 3 Timer1_Timer "Ch09-4c.vbp" 9-38 s 9-7

63 VB VB Public Dim Private Static Dim ( )1. Visual Basic (B) (C) (D) (A) ( )2. (A) (B) (C) (D) ( )3. (A) (B) (C) (D)

64 64 II ( )1. Visual Basic (A) (B) (C) (D) ( )2. Visual Basic (A)x (B)ck (C) sex (D)name Dim name As String Function ring( ) As Integer Dim id As String Dim sex As Boolean Private Sub Command1_Click( ) Static ck As Integer, x As Single x = ring(ck) ( )3. Visual Basic (A)Dim (B)Static (C)Public (D)Private ( )4. (A) (B) (C) (D) 1. Visual Basic Timer1 Interval Timer1_Timer Private Sub Timer1_Timer( ) min As Integer sec As Integer If sec < 60 Then sec = sec + 1 Else min = min + 1 sec = 0 End If Cls Print " " & min & " " & sec & " "

65 Form1 ' Form1 ' Module1 Private y As Integer Public x As Integer Sub add( ) Sub chx( ) x = x + 1 x = x + 10 y = y + 1 Private Sub Command1_Click( ) Call chx Call add Print x + y N As Integer Const value = 100 Sub Utility(cnt As Integer) N = value - cnt If N > 0 Then Print " N = " & N End If Private Sub Form_Click( ) count As Integer count = count + 1 Call Utility(count) 5

66 66 II ( )1. Visual Basic (A)8 30 (B)30 8 (C)83 (D)38 Private Sub Form_Activate( ) Dim x As Integer, y As Integer x = 8: y = 30 Call change(x, y) Print x;y Sub change(a As Integer, b As Integer) Dim temp As Integer If a < b Then temp = a a = b b = temp End If ( )2. (A) (B) (C) (D) ( )3. Function (A)Option (B)Public (C)Private (D)Static ( )4. (A) Visual Basic (B) (C) (D).frm.bas ( )5. Public Private (A) Public (B) Private (C) Public (D) Private

67 9 67 ( )6. (A) (B) (C) (D) Visual Basic Dim Static ( )7. A B x C x P x x (A) C x P (B) P x P x x (C) P A x A.x (D) B C C.x ( )8. Visual Basic (A)205 (B)75 (C)15 (D)125 ' Form1 ' Module1 Public x As Integer Public x As Integer Sub fp( ) Sub mp(y As Integer) x = 5 x = y / Form1.x Private Sub Form_Activate( ) Dim x As Integer x = 100 Call fp Call mp(x) Print x + Module1.x + Form1.x

68 68 II 1. "Ex09-c.vbp" game( ) (1) game( ) 60~90 (2) game( ) x (3) "Sp09-c.frm" "Sp09-c.vbp" 2. "Ex09-d.vbp" Run( ) (1) Run( ) String( ) (2) If-Then-Else Label2 (3) "Sp09-d.frm" "Sp09-d.vbp"

11-1 11-1.1 11-1.2 11-2 11-2.1 11-2.2 108 II 11-1 Timer 11-1.1 Windows 11-1 11-1 Visual Basic Animation Animation 11 109 Animation Animation RLE AVI AVI 11-2 Visual Basic Animation / Microsoft Windows

More information

Visual Basic

Visual Basic 12-1 12-2 12-3 12-1.1 12-1.2 12-2.1 12-2.2 12-3.1 12-3.2 12-4 12-5 12-4.1 12-4.2 12-5.1 12-5.2 140 II 12-1 data file 12-1.1 record field 4 12-1 4 12 141 12-1... 12-1.2 sequential file random file binary

More information

Visual Basic 6 Lecture 7. The List Box:

Visual Basic 6 Lecture 7. The List Box: The List Box: The function of the List Box is to present a list of items where the user can click and select the items from the list or we can use the List Box control as a simple memory to save data.

More information

Programming with visual Basic:

Programming with visual Basic: Programming with visual Basic: 1-Introdution to Visual Basics 2-Forms and Control tools. 3-Project explorer, properties and events. 4-make project, save it and its applications. 5- Files projects and exercises.

More information

The Control Properties

The Control Properties The Control Properties Figure Before writing an event procedure for the control to response to a user's input, you have to set certain properties for the control to determine its appearance and how it

More information

Function: function procedures and sub procedures share the same characteristics, with

Function: function procedures and sub procedures share the same characteristics, with Function: function procedures and sub procedures share the same characteristics, with one important difference- function procedures return a value (e.g., give a value back) to the caller, whereas sub procedures

More information

Start Visual Basic. Session 1. The User Interface Form (I/II) The Visual Basic Programming Environment. The Tool Box (I/II)

Start Visual Basic. Session 1. The User Interface Form (I/II) The Visual Basic Programming Environment. The Tool Box (I/II) Session 1 Start Visual Basic Use the Visual Basic programming environment Understand Essential Visual Basic menu commands and programming procedure Change Property setting Use Online Help and Exit Visual

More information

( ) 1.,, Visual Basic,

( ) 1.,, Visual Basic, ( ) 1. Visual Basic 1 : ( 2012/2013) :. - : 4 : 12-14 10-12 2 http://www.institutzamatematika.com/index.ph p/kompjuterski_praktikum_2 3 2 / ( ) 4 90% 90% 10% 90%! 5 ? 6 "? : 7 # $? - ( 1= on 0= off ) -

More information

Angel International School - Manipay 1 st Term Examination November, 2015

Angel International School - Manipay 1 st Term Examination November, 2015 Grade 10 Angel International School - Manipay 1 st Term Examination November, 2015 Information & Communication Technology Duration: 3.00 Hours Part 1 Choose the appropriate answer 1) Find the correct type

More information

20. VB Programming Fundamentals Variables and Procedures

20. VB Programming Fundamentals Variables and Procedures 20. VB Programming Fundamentals Variables and Procedures 20.1 Variables and Constants VB, like other programming languages, uses variables for storing values. Variables have a name and a data type. Array

More information

2-26 Learn Visual Basic 6.0

2-26 Learn Visual Basic 6.0 2-26 Learn Visual Basic 6.0 cmdcompute Click Event: Private Sub cmdcompute_click() Dim Mean As Single Dim StdDev As Single txtinput.setfocus Make sure there are at least two values If NumValues < 2 Then

More information

NATIONAL DIPLOMA IN COMPUTER TECHNOLOGY

NATIONAL DIPLOMA IN COMPUTER TECHNOLOGY UNESCO-NIGERIA TECHNICAL & VOCATIONAL EDUCATION REVITALISATION PROJECT-PHASE II NATIONAL DIPLOMA IN COMPUTER TECHNOLOGY OOBASIC/VISUAL BASIC PROGRAMMING COURSE CODE: COM 211 YEAR I SEMESTER II PRACTICAL

More information

Sample Paper 2010 Class XII Subject Informatic Practices

Sample Paper 2010 Class XII Subject Informatic Practices Sample Paper 2010 Class XII Subject Informatic Practices (Section A) Q1. Answer the following Questions a) Visual Basic is not an Object Oriented Language Justify this statement. 2 b) How is a standard

More information

Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code

Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code Your comments and suggestions on the operation of this software are welcome. Please address them to: ICONICS 100 Foxborough Blvd. Foxborough, MA 02035 Tel: 508-543-8600 Fax: 508-543-1503 E-mail: support@iconics.com

More information

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA IN INFORMATION TECHNOLOGY Semester: 4

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA IN INFORMATION TECHNOLOGY Semester: 4 GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA IN INFORMATION TECHNOLOGY Semester: 4 Subject Name VISUAL BASIC Sr.No Course content 1. 1. Introduction to Visual Basic 1.1. Programming Languages 1.1.1. Procedural,

More information

Angel International School - Manipay 1 st Term Examination November, 2015

Angel International School - Manipay 1 st Term Examination November, 2015 Angel International School - Manipay 1 st Term Examination November, 2015 Information & Communication Technology Grade 11A & C Duration: 3.00 Hours Part 1 Choose the most appropriate answer. 1) Find the

More information

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB Visual Programming 1. What is Visual Basic? Visual Basic is a powerful application development toolkit developed by John Kemeny and Thomas Kurtz. It is a Microsoft Windows Programming language. Visual

More information

Control Properties. Example: Program to change background color

Control Properties. Example: Program to change background color Control Properties Before writing an event procedure for the control to response to an event, you have to set certain properties for the control to determine its appearance and how will it work with the

More information

Propose a mathematical formula to verify the authenticity of any product of the integers using a scale (9) and verified using computer

Propose a mathematical formula to verify the authenticity of any product of the integers using a scale (9) and verified using computer (9) Propose a mathematical formula to verify the authenticity of any product of the integers using a scale (9) and verified using computer. (9). Abstract This research aims to propose a mathematical formula

More information

IS 320 A/B Winter 1998 Page 1 Exam 1

IS 320 A/B Winter 1998 Page 1 Exam 1 IS 320 A/B Winter 1998 Page 1 Use your own paper to answer the questions. You may do work on this document but transfer your answers to separate sheets of paper. Turn in this document as well as your answers

More information

2Practicals Visual Basic 6.0

2Practicals Visual Basic 6.0 2Practicals Visual Basic 6.0 Practical 1: 1. Navigation of Visual Basic Integrated Development Environment The Visual Basic IDE is made up of a number of components Menu Bar Tool Bar Project Explorer Properties

More information

PROGRAM 1: SIMPLE CALCULATOR

PROGRAM 1: SIMPLE CALCULATOR PROGRAM 1: SIMPLE CALCULATOR Option Explicit Dim operand1 As Double, operand2 As Double Dim op1 As Double, op2 As Double Dim operator As String Dim cleardisplay As Boolean Private Sub Cmdclear_Click()

More information

IS 320 Spring 96 Page 1 Exam 1. Please use your own paper to answer the following questions. Point values are shown in parentheses.

IS 320 Spring 96 Page 1 Exam 1. Please use your own paper to answer the following questions. Point values are shown in parentheses. IS 320 Spring 96 Page 1 Please use your own paper to answer the following questions. Point values are shown in parentheses. 1. (10) Consider the following segment of code: If txtansicode.text < "0" Or

More information

HELP - VB TIPS. ANIMATE AN IMAGE BOX Insert a module. In this module, create a global variable: Global x

HELP - VB TIPS. ANIMATE AN IMAGE BOX Insert a module. In this module, create a global variable: Global x HELP - VB TIPS Load an image to an image box from a certain folder If you use this method, won t work on N:\ To load an image to a image control Image1.Picture = LoadPicture("H:\MyVBfolder\stop.gif") Load

More information

(Subroutines in Visual Basic)

(Subroutines in Visual Basic) Ch 7 Procedures (Subroutines in Visual Basic) Visual Basic Procedures Structured Programs To simplify writing complex programs, most Programmers (Designers/Developers) choose to split the problem into

More information

Visual Basic.NET. 1. Which language is not a true object-oriented programming language?

Visual Basic.NET. 1. Which language is not a true object-oriented programming language? Visual Basic.NET Objective Type Questions 1. Which language is not a true object-oriented programming language? a.) VB.NET b.) VB 6 c.) C++ d.) Java Answer: b 2. A GUI: a.) uses buttons, menus, and icons.

More information

Revision for Final Examination (Second Semester) Grade 9

Revision for Final Examination (Second Semester) Grade 9 Revision for Final Examination (Second Semester) Grade 9 Name: Date: Part 1: Answer the questions given below based on your knowledge about Visual Basic 2008: Question 1 What is the benefit of using Visual

More information

Lecture Using ListBox and ComboBox Controls In Visual Basic 6: list box

Lecture Using ListBox and ComboBox Controls In Visual Basic 6: list box Lecture 10+11+12 7- Using ListBox and ComboBox Controls In 6: list box A list box displays a list of items from which the user can select one or more items. If the number of items exceeds the number that

More information

Please answer questions in the space provided. Question point values are shown in parentheses.

Please answer questions in the space provided. Question point values are shown in parentheses. IS 320 Spring 99 Page 1 Please answer questions in the space provided. Question point values are shown in parentheses. 1. (15) Assume you have the following variable declarations and assignments: Dim A

More information

Language Fundamentals

Language Fundamentals Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long

More information

VISUAL BASIC 6.0 OVERVIEW

VISUAL BASIC 6.0 OVERVIEW VISUAL BASIC 6.0 OVERVIEW GENERAL CONCEPTS Visual Basic is a visual programming language. You create forms and controls by drawing on the screen rather than by coding as in traditional languages. Visual

More information

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type >

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type > VBA Handout References, tutorials, books Excel and VBA tutorials Excel VBA Made Easy (Book) Excel 2013 Power Programming with VBA (online library reference) VBA for Modelers (Book on Amazon) Code basics

More information

Information Hiding In Images Using Randomly Selected Points

Information Hiding In Images Using Randomly Selected Points Republic of Iraq Ministry Of Higher Education And Scientific Research University Of Baghdad College Of Science Department Of Computer Science Information Hiding In Images Using Randomly Selected Points

More information

On Railway Reservation. U G D C A Semester VI. Roll No DA

On Railway Reservation. U G D C A Semester VI. Roll No DA On Railway Reservation U G D C A Semester VI Submitted to: Dr. P. K. Sen (Co-ordinator) Submitted By: (Name of Student) Roll No. 14836DA Contents 1. Acknowledgement 2. Objectives 3. Declaration 4. Analysis

More information

Chapter 1. Block Diagram. Text .. 1

Chapter 1. Block Diagram. Text .. 1 Chapter 1 ก Visual Basic Scilab ก ก Visual Basic Scilab ก ก (Temporary File) ก ก ก ก ก ก Visual Basic ก (Interface) ก Scilab Text File ก Visual Basic ก ก ก ก Block Diagram ก ก Visual Basic ก Scilab ก.sce

More information

CMPT 110 MIDTERM OCTOBER 18, 2001

CMPT 110 MIDTERM OCTOBER 18, 2001 CMPT 110 MIDTERM OCTOBER 18, 2001 1 What will be displayed when the command button is clicked? 7% Level of difficulty 7 (out of 10) Assume there is a command button called cmdbutton Assume there is a picturebox

More information

Visual Basic , ,. Caption Hello, On Off. * + +, -. 1-Arrow, , 2- Cross. - project1.vbp, 4-form1.frm.

Visual Basic , ,. Caption Hello, On Off. * + +, -. 1-Arrow, , 2- Cross. - project1.vbp, 4-form1.frm. Visual Basic 6.0 1.,. Caption Hello, On Off. * + +, -. 1-Arrow, + - 4 +, 2- Cross. - project1.vbp, 4-form1.frm...!"# 2/59 3...

More information

Universitas Sumatera Utara

Universitas Sumatera Utara 43 L A M P I R A N 44 Penulisan Kode Program Aplikasi Game Tetris A. Kode program aplikasi game tetris untuk form1 ( MainF.frm ) adalah sebagai berikut. Dim BANK As Database Dim RS As DAO.Recordset Private

More information

Write the code for the click event for the Move>> button that emulates the behavior described above. Assume you already have the following code:

Write the code for the click event for the Move>> button that emulates the behavior described above. Assume you already have the following code: IS 320 Spring 2000 page 1 1. (13) The figures below show two list boxes before and after the user has clicked on the Move>> button. Notice that the selected items have been moved to the new list in the

More information

Before We Begin. Introduction to Computer Use II. Overview (1): Winter 2006 (Section M) CSE 1530 Winter Bill Kapralos.

Before We Begin. Introduction to Computer Use II. Overview (1): Winter 2006 (Section M) CSE 1530 Winter Bill Kapralos. Winter 2006 (Section M) Topic E: Subprograms Functions and Procedures Wednesday, March 8 2006 CSE 1530, Winter 2006, Overview (1): Before We Begin Some administrative details Some questions to consider

More information

Lookup Project. frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function:

Lookup Project. frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function: Lookup Project frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function: Help About, in a Message Box lookup.vbp programmed by C.Gribble Page 2 Code for

More information

Las Vegas, Nevada, December 3 6, Kevin Vandecar. Speaker Name:

Las Vegas, Nevada, December 3 6, Kevin Vandecar. Speaker Name: Las Vegas, Nevada, December 3 6, 2002 Speaker Name: Kevin Vandecar Course Title: Introduction to Visual Basic Course ID: CP11-3 Session Overview: Introduction to Visual Basic programming is a beginning

More information

Type Storage Range of Values

Type Storage Range of Values University of Misan College of Engineering Department of Civil Engineering Course Title: Visual Basic Second Stage Fourth Lecture Visual Basic Data There are many types of data that we come across in our

More information

2. (16) Salesperson bonuses are paid based on a combination of total unit sales and the number of new accounts according to the following table:

2. (16) Salesperson bonuses are paid based on a combination of total unit sales and the number of new accounts according to the following table: IS 320 Exam 1 page 1 Please use the space provided on this exam to answer the questions. Clearly show your work for possible partial credit. Question point values are shown in parenthses. 1. (16) Given

More information

IDENTIFYING UNIQUE VALUES IN AN ARRAY OR RANGE (VBA)

IDENTIFYING UNIQUE VALUES IN AN ARRAY OR RANGE (VBA) Date: 20/11/2012 Procedure: Identifying Unique Values In An Array Or Range (VBA) Source: LINK Permalink: LINK Created by: HeelpBook Staff Document Version: 1.0 IDENTIFYING UNIQUE VALUES IN AN ARRAY OR

More information

Visual Basic ,

Visual Basic , Visual Basic 6.0..!"# !"# $#%$$"& ( ( 6.0) 2 $, -&, - 1.,. Caption Hello, On O ff. * + +, -. 1-Arrow, + - 4 +, 2- Cross. - project1.vbp, 4-form1.frm. 2/59 !"# $#%$$"& ( ( 6.0) 3 $, -&, - 3/59 !"# $#%$$"&

More information

EMPLOYEE PAYROLL SYSTEM

EMPLOYEE PAYROLL SYSTEM EX.NO:1 DATE: EMPLOYEE PAYROLL SYSTEM AIM: To develop a Employee Payroll System using visual Basic. PROCEDURE: 1. Problem statement Software is to be designed for supporting a computerized employee payroll

More information

Sub Programs. To Solve a Problem, First Make It Simpler

Sub Programs. To Solve a Problem, First Make It Simpler Sub Programs To Solve a Problem, First Make It Simpler Top Down Design Top Down Design Start with overall goal. Break Goal into Sub Goals Break Sub Goals into Sub Sub Goals Until the Sub-Sub Sub-Sub Sub-Sub

More information

CS 2113 Midterm Exam, November 6, 2007

CS 2113 Midterm Exam, November 6, 2007 CS 2113 Midterm Exam, November 6, 2007 Problem 1 [20 pts] When the following VBA program is executed, what will be displayed in the message box? Option Explicit Sub problem1() Dim m As Integer, n As Integer

More information

Visual Basic

Visual Basic 1 P a g e Visual Basic 6.0 Punjab University papers Visual Basic 6.0 2007 Question No 1(a). What is an algorithm and pseudo code? 5.0 1(b). What is OOP? Explain its importance 5.0 Question No 2(a) what

More information

CPSC 203 Extra review and solutions

CPSC 203 Extra review and solutions CPSC 203 Extra review and solutions Multiple choice questions: For Questions 1 6 determine the output of the MsgBox 1) x = 12 If (x > 0) Then s = s & "a" s = s & "b" a. a b. b c. s d. ab e. None of the

More information

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 4 Procedural Abstraction and Functions That Return a Value 1 Overview 4.1 Top-Down Design 4.2 Predefined Functions 4.3 Programmer-Defined Functions 4.4 Procedural Abstraction 4.5 Local Variables

More information

Random numbers program

Random numbers program Fundamentals of Computer Science 2010-2011 Laboratory 11 Vectors (1) Objectives: Acquire abilities in the use of vectors (one-dimensional arrays) Get to know the generation of pseudo-random numbers Lower

More information

ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration

ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration ENGG1811 UNSW, CRICOS Provider No: 00098G W9 slide 1 References & Info Chapra (Part 2 of ENGG1811 Text) Topic 21 (chapter

More information

Visual Basic. The Integrated Development Environment. Menu Bar

Visual Basic. The Integrated Development Environment. Menu Bar Visual Basic Visual Basic is initiated by using the Programs option > Microsoft Visual Basic 6.0 > Visual Basic 6.0. Clicking the Visual Basic icon, we can view a copyright screen enlisting the details

More information

IS 320 A-C Page 1 Spring 99 Exam 2

IS 320 A-C Page 1 Spring 99 Exam 2 IS 320 A-C Page 1 Please use the space provided on the exam for your answers to the following questions. Note that question values are shown in parentheses. 1. (18) Consider the following user interface

More information

Computer Net Revision

Computer Net Revision First:In the following Form window, if it is required to store entries from the user in variables. Define the corresponding Data Type for each input. 1. 2. 3. 4. 1 2 3 4 1- Less number of bytes means more

More information

CS130/230 Lecture 12 Advanced Forms and Visual Basic for Applications

CS130/230 Lecture 12 Advanced Forms and Visual Basic for Applications CS130/230 Lecture 12 Advanced Forms and Visual Basic for Applications Friday, January 23, 2004 We are going to continue using the vending machine example to illustrate some more of Access properties. Advanced

More information

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202)

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202) Lecture No:5 Boolean Expressions and Definitions Boolean Algebra Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses only the binary numbers i.e. 0 and 1. It is also called

More information

LAMPIRAN FORM 1 Universitas Sumatera Universitas Utara

LAMPIRAN FORM 1 Universitas Sumatera Universitas Utara LAMPIRAN FORM 1 Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = vbkeyreturn Then Set tbladministrator = New ADODB.Recordset With tbladministrator.open "SELECT * FROM Administrator WHERE userid

More information

CPSC 230 Extra review and solutions

CPSC 230 Extra review and solutions Extra review questions: the following questions are meant to provide you with some extra practice so you need to actually try them on your own to get anything out of it. For that reason, solutions won't

More information

Download the files from you will use these files to finish the following exercises.

Download the files from  you will use these files to finish the following exercises. Exercise 6 Download the files from http://www.peter-lo.com/teaching/x4-xt-cdp-0071-a/source6.zip, you will use these files to finish the following exercises. 1. This exercise will guide you how to create

More information

S.2 Computer Literacy Question-Answer Book

S.2 Computer Literacy Question-Answer Book S.2 C.L. Half-yearly Examination (2012-13) 1 12-13 S.2 C.L. Question- Answer Book Hong Kong Taoist Association Tang Hin Memorial Secondary School 2012-2013 Half-yearly Examination S.2 Computer Literacy

More information

DroidBasic Syntax Contents

DroidBasic Syntax Contents DroidBasic Syntax Contents DroidBasic Syntax...1 First Edition...3 Conventions Used In This Book / Way Of Writing...3 DroidBasic-Syntax...3 Variable...4 Declaration...4 Dim...4 Public...4 Private...4 Static...4

More information

UnitSales Array Product Number Sales Region

UnitSales Array Product Number Sales Region IS 320 Aut 96 Page 1 1. (10) Assume you have a list box named List1, which has its Multiselect property set to 2 - Extended. Write a click event procedure for this list box that deletes the selected items

More information

ต วอย างการสร างฟอร ม เมน การใช งาน

ต วอย างการสร างฟอร ม เมน การใช งาน ต วอย างการสร างฟอร ม เมน การใช งาน Option Explicit Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim Sql As String Private Sub Command6_Click() Form2.Hide Form3.Show Private Sub Command7_Click()

More information

Lecture 11: Subprograms & their implementation. Subprograms. Parameters

Lecture 11: Subprograms & their implementation. Subprograms. Parameters Lecture 11: Subprograms & their implementation Subprograms Parameter passing Activation records The run-time stack Implementation of static and dynamic scope rules Subprograms A subprogram is a piece of

More information

1. General Computer Questions

1. General Computer Questions CE 311K Introduction to Computer Methods McKinney Example Problems Section Page 1. General Computer Questions... 1 2. Flowcharts... 2 3. Number Systems... 3 5. Programming Language Facts... 4 1. General

More information

VISUAL BASIC For Engineers & Scientists. Shahab D. Mohaghegh, Ph.D. Professor Petroleum & Natural Gas Engineering West Virginia University

VISUAL BASIC For Engineers & Scientists. Shahab D. Mohaghegh, Ph.D. Professor Petroleum & Natural Gas Engineering West Virginia University VISUAL BASIC For Engineers & Scientists Shahab D. Mohaghegh, Ph.D. Professor Petroleum & Natural Gas Engineering West Virginia University March 1997 TABLE OF CONTENTS Chapter 1: Problem Solving with Visual

More information

VISUAL BASIC SERVER INTERFACE CODE. Visual Basic 6 Graphical Interface 103. Visual Basic Module rtsscomm.bas Code.115

VISUAL BASIC SERVER INTERFACE CODE. Visual Basic 6 Graphical Interface 103. Visual Basic Module rtsscomm.bas Code.115 APPENDIX E VISUAL BASIC SERVER INTERFACE CODE Page E.1: E.2: E.3: E.4: E.5: Visual Basic 6 Graphical Interface 103 Visual Basic Form gyrofront.frm Code.....104 Visual Basic Module mydatatypes.bas Code..114

More information

KENDRIYA VIDYALAYA SANGATHAN Class- XI [INFORMATICS PRACTICES] Time Duration: 3 Hrs M. M. 70 General instruction: All questions are compulsory

KENDRIYA VIDYALAYA SANGATHAN Class- XI [INFORMATICS PRACTICES] Time Duration: 3 Hrs M. M. 70 General instruction: All questions are compulsory KENDRIYA VIDYALAYA SANGATHAN Class- XI [INFORMATICS PRACTICES] Time Duration: 3 Hrs M. M. 70 General instruction: All questions are compulsory SECTION A Q1. a) What are Header and Footer in MS word? 2

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,

More information

Data Compression Fundamentals

Data Compression Fundamentals 1 Data Compression Fundamentals Touradj Ebrahimi Touradj.Ebrahimi@epfl.ch 2 Several classifications of compression methods are possible Based on data type :» Generic data compression» Audio compression»

More information

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each. I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK 70. a) What is the difference between Hardware and Software? Give one example for each. b) Give two differences between primary and secondary memory.

More information

NOTES: Procedures (module 15)

NOTES: Procedures (module 15) Computer Science 110 NAME: NOTES: Procedures (module 15) Introduction to Procedures When you use a top-down, structured program design, you take a problem, analyze it to determine what the outcome should

More information

ADVANCED ALGORITHMS TABLE OF CONTENTS

ADVANCED ALGORITHMS TABLE OF CONTENTS ADVANCED ALGORITHMS TABLE OF CONTENTS ADVANCED ALGORITHMS TABLE OF CONTENTS...1 SOLVING A LARGE PROBLEM BY SPLITTING IT INTO SEVERAL SMALLER SUB-PROBLEMS CASE STUDY: THE DOOMSDAY ALGORITHM... INTRODUCTION

More information

IS 320 A/B Spring 97 Page 1 Exam 1

IS 320 A/B Spring 97 Page 1 Exam 1 IS 320 A/B Spring 97 Page 1 Please use the paper supplied by the instructor to answer the questions. Question point values are shown in parentheses. 1. (18) What output is generated by the three MsgBox

More information

INDIAN SCHOOL MUSCAT MIDDLE SECTION DEPARTMENT OF MATHEMATICS FINAL TERM EXAMINATION CLASS - 8 (ANSWER KEY) SECTION A Qns

INDIAN SCHOOL MUSCAT MIDDLE SECTION DEPARTMENT OF MATHEMATICS FINAL TERM EXAMINATION CLASS - 8 (ANSWER KEY) SECTION A Qns SECTION A Qns Ans. Find the HCF of 4x y, 6xy, xy xy. Write the standard form of 0.000007065. 7.065 0 6. Write the co-ordinates of the Origin. ( 0, 0 ) 4. The number of digits in the square root of 664

More information

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net UNIT 1 Introduction to Microsoft.NET framework and Basics of VB.Net 1 SYLLABUS 1.1 Overview of Microsoft.NET Framework 1.2 The.NET Framework components 1.3 The Common Language Runtime (CLR) Environment

More information

Syntax. Table of Contents

Syntax. Table of Contents Syntax Table of Contents First Edition2 Conventions Used In This Book / Way Of Writing..2 KBasic-Syntax..3 Variable.4 Declaration4 Dim4 Public..4 Private.4 Protected.4 Static.4 As..4 Assignment4 User Defined

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is InputBox( ) Function An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is A = InputBox ( Question or Phrase, Window Title, ) Example1: Integer:

More information

3. Can every Do-Loop loop be written as a For-Next loop? Why or why not? 4. Name two types of files that can be opened and used in a VB program.

3. Can every Do-Loop loop be written as a For-Next loop? Why or why not? 4. Name two types of files that can be opened and used in a VB program. CE 311 K Fall 005 Second Exam - Examples Answers at the bottom. 1. What are two categories of flow control structures?. Name three logical operators in Visual Basic (VB). 3. Can every Do-Loop loop be written

More information

Answer: C. 7. In window we can write code A. Immediate window B. Locals window C. Code editor window D. None of these. Answer: C

Answer: C. 7. In window we can write code A. Immediate window B. Locals window C. Code editor window D. None of these. Answer: C 1. Visual Basic is a tool that allows you to develop application in A. Real time B. Graphical User Interface C. Menu Driven D. None Of These 2. IDE stands for.. A. Internet Development Environment B. Integrated

More information

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants These notes are available on the IMS1906 Web site http://www.sims.monash.edu.au Tutorial Sheet 4/Week 5 Please

More information

Visual Basic ,

Visual Basic , Visual Basic 6.0 1.,. Caption Hello, On O ff. * + +, -. 1-Arrow, + - 4 +, 2- Cross. - project1.vbp, 4-form1.frm...!"# 2/59 3...

More information

Outline. Midterm Review. Using Excel. Midterm Review: Excel Basics. Using VBA. Sample Exam Question. Midterm Review April 4, 2014

Outline. Midterm Review. Using Excel. Midterm Review: Excel Basics. Using VBA. Sample Exam Question. Midterm Review April 4, 2014 Midterm Review Larry Caretto Mechanical Engineering 209 Computer Programming for Mechanical Engineers April 4, 2017 Outline Excel spreadsheet basics Use of VBA functions and subs Declaring/using variables

More information

Final Exam 7:00-10:00pm, April 14, 2008

Final Exam 7:00-10:00pm, April 14, 2008 Name:, (last) (first) Student Number: Section: Instructor: _P. Cribb_ L. Lowther_(circle) York University Faculty of Science and Engineering Department of Computer Science and Engineering Final Exam 7:00-10:00pm,

More information

Programming with Visual Studio Higher (v. 2013)

Programming with Visual Studio Higher (v. 2013) Programming with Visual Studio Higher (v. 2013) Contents/Requirements Checklist Multiple selection: using ifs & case While Loops Using arrays Filling arrays Displaying array contents Types of variables:

More information

Higher Computing Science Software Design and Development - Programming Summary Notes

Higher Computing Science Software Design and Development - Programming Summary Notes Higher Computing Science Software Design and Development - Programming Summary Notes Design notations A design notation is the method we use to write down our program design. Pseudocode is written using

More information

Homework Assignment 2. Due Date: October 21th, :30pm (noon) CS425 - Database Organization Results

Homework Assignment 2. Due Date: October 21th, :30pm (noon) CS425 - Database Organization Results Name CWID Homework Assignment 2 Due Date: October 21th, 2014 12:30pm (noon) CS425 - Database Organization Results Please leave this empty! 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.15 2.16 2.17

More information

by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc.

by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc. Version 2.0 1998-2002 by NetMedia, Inc. All rights reserved. Basic Express, BasicX, BX-01, BX-24 and BX-35 are trademarks of NetMedia, Inc. Microsoft, Windows and Visual Basic are either registered trademarks

More information

Complete program to solve a 2 nd degree equation

Complete program to solve a 2 nd degree equation Fundamentals of Computer Science 2010-2011 Laboratory 10 Functions and procedures (3) Objectives: To go deeply into the use of subprograms and passing parameters by reference To go deeply into the manipulation

More information

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81%

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% 1. (2 pts) See text. You can t be sloppy defining terms like this. You must show a bijection between the natural numbers

More information

Chapter 4: Regular Expressions

Chapter 4: Regular Expressions CSI 3104 /Winter 2011: Introduction to Formal Languages What are the languages with a finite representation? We start with a simple and interesting class of such languages. Dr. Nejib Zaguia CSI3104-W11

More information

C:\MasterPageWeb\HAPR\docu\HAPR_VB6_version15sept06.rtf 19/10/08. HARP_VB projet en VB6

C:\MasterPageWeb\HAPR\docu\HAPR_VB6_version15sept06.rtf 19/10/08. HARP_VB projet en VB6 HARP_VB projet en VB6 Option Explicit Dim Value As Integer Dim i As Integer Dim il As Long Dim LL, L1S, L250µS, L500µS, L1mS, L2mS, L5mS, L10mS As Single Dim offsetdepart As Long Dim police(256, 8) As

More information

Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson

Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson Introduction Among the many new features of PATROL version 3.3, is support for Microsoft s Component Object Model (COM).

More information

Lab Sheet 4.doc. Visual Basic. Lab Sheet 4: Non Object-Oriented Programming Practice

Lab Sheet 4.doc. Visual Basic. Lab Sheet 4: Non Object-Oriented Programming Practice Visual Basic Lab Sheet 4: Non Object-Oriented Programming Practice This lab sheet builds on the basic programming you have done so far, bringing elements of file handling, data structuring and information

More information

ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures ITEC2620 Introduction to Data Structures Lecture 9b Grammars I Overview How can a computer do Natural Language Processing? Grammar checking? Artificial Intelligence Represent knowledge so that brute force

More information