Visual Basic 6.0

Visual Basic 6.0

Slip 6

Q.1) Write a VB Program to find transpose of given matrix. [Marks 15]

Solution

Dim A(2, 2) As Integer
Dim x(2, 2) As Integer
Dim i As Integer
Dim j As Integer

Private Sub Command1_Click()
For i = 1 To 2
  For j = 1 To 2
  A(i, j) = Val(InputBox("A matrix"))
  Next j
  Next i
 
For i = 1 To 2
  For j = 1 To 2
  x(i, j) = A(j, i)
  Next j
  Next i
 
 Print "A matrix"
 For i = 1 To 2
 For j = 1 To 2
 Print A(i, j); "  ";
 Next j
 Print "  "
 Next i

 Print "X matrix"
 For i = 1 To 2
 For j = 1 To 2
 Print x(i, j); "  ";
 Next j
 Print "  "
 Next i
End Sub

Output

Transpose


Q.2) Write a VB program to create a Stop Watch. It contains buttons Start, Stop, Pause and
Reset. It should display time in hours, minute, second, millisecond. [Marks 25]

Solution

Dim starttime As Date
Dim s1 As Date

Private Sub Command1_Click()
starttime = Now
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub

Private Sub Command3_Click()
If Command3.Caption = "pause" Then
Timer1.Enabled = False
Label1.Caption = s1
Command1.Caption = "play"
End If
If Command3.Caption = "play" Then
Timer1.Enabled = False
Label1.Caption = s1
End If
End Sub

Private Sub Command4_Click()
Timer1.Enabled = False
starttime = Now
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Label1.Caption = Format(Now - starttime, "hh:mm:ss:ms")
End Sub


Output

Timer

BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

2 Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
Previous Post Next Post