Visual Basic 6.0 Practical Exercises Pdf __link__ (PRO)

Visual Basic 6.0 allows for rapid application development (RAD). Practicing with VB6 helps you understand:

Data persistence is where VB6 shines. This module explores ActiveX Data Objects (ADO) to connect forms to databases. Exercise 4.1: Student Information System (Local Database) visual basic 6.0 practical exercises pdf

Dim firstNumber As Double Dim activeOperator As String Dim isNewNumber As Boolean Private Sub Form_Load() isNewNumber = True End Sub Private Sub cmdNumber_Click(Index As Integer) If isNewNumber Then txtDisplay.Text = Index isNewNumber = False Else txtDisplay.Text = txtDisplay.Text & Index End If End Sub Private Sub cmdOperators_Click(Index As Integer) firstNumber = Val(txtDisplay.Text) activeOperator = cmdOperators(Index).Caption isNewNumber = True End Sub Private Sub cmdEqual_Click() Dim secondNumber As Double Dim result As Double secondNumber = Val(txtDisplay.Text) Select Case activeOperator Case "+" result = firstNumber + secondNumber Case "-" result = firstNumber - secondNumber Case "*" result = firstNumber * secondNumber Case "/" If secondNumber = 0 Then MsgBox "Error: Cannot divide by zero!", vbCritical, "Math Error" txtDisplay.Text = "0" isNewNumber = True Exit Sub Else result = firstNumber / secondNumber End If End Select txtDisplay.Text = CStr(result) isNewNumber = True End Sub Private Sub cmdClear_Click() txtDisplay.Text = "0" firstNumber = 0 activeOperator = "" isNewNumber = True End Sub Use code with caution. Exercise 1.2: Interactive String Manipulator Visual Basic 6