Вы находитесь на странице: 1из 16

Name: Vinay Patil (TYIT-C-3572)

Q 1)

Coding:
Private Sub cmdAdd_Click()
If txtMsg.Text = "" Then
MsgBox "Enter Require data !!!", vbInformation, "Error"
Else
lblMsg.Caption = txtMsg.Text
lstMsg.AddItem txtMsg.Text
txtMsg.Text = ""
End If
End Sub

Private Sub cmdDisplay_Click()


dlgGeneral.Flags = cdlCFScreenFonts
dlgGeneral.ShowFont
With dlgGeneral
lblMsg.Font.Name = .FontName
lblMsg.FontSize = .FontSize
End With
dlgGeneral.Flags = cdlCCRGBInit
dlgGeneral.ShowColor
lblMsg.ForeColor = dlgGeneral.Color
End Sub
Name: Vinay Patil (TYIT-C-3572)

Private Sub cmdExit_Click()


End
End Sub

Private Sub cmdOk_Click()


lblCount.Caption = "Total no of Messages : " & lstMsg.ListCount
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 2)

Coding:
Dim num(10) As Integer
Dim i As Integer

Private Sub cmdAdd_Click()


If txtNumber.Text = "" Then
MsgBox "Enter any number !!! ", vbInformation, "Error"
txtNumber.SetFocus
Else
num(i) = txtNumber.Text
i=i+1
txtNumber.Text = ""
txtNumber.SetFocus
End If
If i = 10 Then
cmdAdd.Enabled = False
cmdDone.Enabled = True
End If
End Sub

Private Sub cmdDone_Click()


For i = 0 To 9
If i Mod 2 = 0 Then
lstEven.AddItem "num(" & i & ") : " & num(i)
Else
lstOdd.AddItem "num(" & i & ") : " & num(i)
End If
Next i
End Sub
Name: Vinay Patil (TYIT-C-3572)

Private Sub cmdExit_Click()


End
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 3)

Coding:
Dim num(10) As Integer
Dim i As Integer
Dim sum As Integer
Dim avg As Single

Private Sub cmdDone_Click()


For i = 0 To 9
sum = sum + num(i)
lstNumber.AddItem num(i)
Next i
avg = sum / 10
lblResults.Caption = "Addition of 10 numbers : " & sum & vbCrLf & _
"Average of 10 numbers : " & avg
End Sub

Private Sub cmdExit_Click()


End
End Sub

Private Sub cmdNext_Click()


If txtNumber.Text = "" Then
MsgBox "Enter any number !!! ", vbInformation, "Error"
txtNumber.SetFocus
Else
num(i) = txtNumber.Text
i=i+1
txtNumber.Text = ""
txtNumber.SetFocus
Name: Vinay Patil (TYIT-C-3572)

End If
If i = 10 Then
cmdNext.Enabled = False
cmdDone.Enabled = True
End If
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 4)

Coding:
Dim num1(10) As Integer
Dim num2(10) As Integer
Dim i As Integer

Private Sub cmdAdd_Click()


If txtNumber.Text = "" Then
MsgBox "Enter any number !!! ", vbInformation, "Error"
txtNumber.SetFocus
Else
num1(i) = txtNumber.Text
i=i+1
txtNumber.Text = ""
txtNumber.SetFocus
End If
If i = 10 Then
cmdAdd.Enabled = False
cmdTransfer.Enabled = True
End If
End Sub

Private Sub cmdExit_Click()


End
End Sub
Name: Vinay Patil (TYIT-C-3572)

Private Sub cmdTransfer_Click()


For i = 0 To 9
num2(i) = num1(i)
lblFirst.Caption = lblFirst.Caption & num1(i) & ","
lblSecond.Caption = lblSecond.Caption & num2(i) & ","
Next i
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 5)

Coding:
Dim num1(10) As Integer
Dim num2(10) As Integer
Dim i As Integer

Private Sub cmdAdd_Click()


If txtNumber.Text = "" Then
MsgBox "Enter any number !!! ", vbInformation, "Error"
txtNumber.SetFocus
Else
num1(i) = txtNumber.Text
i=i+1
txtNumber.Text = ""
txtNumber.SetFocus
End If
If i = 10 Then
cmdAdd.Enabled = False
cmdTransfer.Enabled = True
End If
End Sub

Private Sub cmdExit_Click()


End
End Sub
Name: Vinay Patil (TYIT-C-3572)

Private Sub cmdTransfer_Click()


Dim j As Integer
For i = 0 To 9
num2(9 - i) = num1(i)
Next i
For i = 0 To 9
lblFirst.Caption = lblFirst.Caption & num1(i) & ","
lblSecond.Caption = lblSecond.Caption & num2(i) & ","
Next i
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 6)

Coding:
Dim num1(5) As Integer
Dim num2(5) As Integer
Dim num3(5) As Integer
Dim i As Integer

Private Sub cmdAdd_Click()


If txtNumber1.Text = "" Or txtNumber2.Text = "" Then
MsgBox "Enter any number !!! ", vbInformation, "Error"
txtNumber1.SetFocus
Else
num1(i) = txtNumber1.Text
num2(i) = txtNumber2.Text
num3(i) = num1(i) * num2(i)
i=i+1
txtNumber1.Text = ""
txtNumber2.Text = ""
txtNumber1.SetFocus
End If
If i = 5 Then
cmdAdd.Enabled = False
cmdDone.Enabled = True
End If
End Sub
Name: Vinay Patil (TYIT-C-3572)

Private Sub cmdDone_Click()


For i = 0 To 4
lstFirst.AddItem " num1(" & i & ") : " & num1(i)
lstSecond.AddItem " num2(" & i & ") : " & num2(i)
lstThird.AddItem " num3(" & i & ") : " & num3(i)
Next i
End Sub

Private Sub cmdExit_Click()


End
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 7)

Coding:
Dim num1(5) As Integer
Dim num2(5) As Integer
Dim num3(5) As Integer
Dim i As Integer

Private Sub cmdAdd_Click()


If txtNumber1.Text = "" Or txtNumber2.Text = "" Then
MsgBox "Enter any number !!! ", vbInformation, "Error"
txtNumber1.SetFocus
Else
num1(i) = txtNumber1.Text
num2(i) = txtNumber2.Text
i=i+1
txtNumber1.Text = ""
txtNumber2.Text = ""
txtNumber1.SetFocus
End If
If i = 5 Then
cmdAdd.Enabled = False
cmdDone.Enabled = True
End If
End Sub

Private Sub cmdDone_Click()


Name: Vinay Patil (TYIT-C-3572)

For i = 0 To 4
num3(i) = num1(i) * num2(4 - i)
lstFirst.AddItem " num1(" & i & ") : " & num1(i)
lstSecond.AddItem " num2(" & i & ") : " & num2(i)
lstThird.AddItem " num3(" & i & ") : " & num3(i)
Next i
End Sub

Private Sub cmdExit_Click()


End
End Sub

Output:
Name: Vinay Patil (TYIT-C-3572)

Q 8)

Coding:
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdOk_Click()
If txtVowel.Text = "" Then
MsgBox "Enter any character !!!", vbInformation, "Error"
txtVowel.SetFocus
Else
Select Case LCase(txtVowel.Text)
Case "a", "e", "i", "o", "u":
lblResult.Caption = "' " & txtVowel.Text & " ' is a Vowel"
Case Else:
lblResult.Caption = "' " & txtVowel.Text & " ' is not a Vowel"
End Select
End If
End Sub
Output:

Q 9)
Name: Vinay Patil (TYIT-C-3572)

Coding:
Dim found As Boolean
Dim listIn As Integer

Private Sub cmdClear_Click()


txtItem.Text = ""
found = False
End Sub

Private Sub txtItem_Change()


found = False
Do While Not found And listIn < lstItems.ListCount
If UCase(Left(lstItems.List(listIn), Len(txtItem.Text))) = UCase(txtItem.Text) Then
lstItems.ListIndex = listIn
found = True
End If
listIn = listIn + 1
Loop
End Sub

Output:

Вам также может понравиться