Dim a(2, 2),
b(2, 2), result(2, 2) As Integer
Private Sub
CmdCreate_Click()
List1.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
a(i, j) = InputBox("Enter No. for Row " & i & " and Column " & j)
str = str & Space(3) & a(i, j)
Next
List1.AddItem str
Next
End Sub
Private Sub CmdTranspose_Click()
List2.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
b(i, j) = a(j, i)
str = str & Space(3) & b(i, j)
Next
List2.AddItem str
Next
End Sub
List1.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
a(i, j) = InputBox("Enter No. for Row " & i & " and Column " & j)
str = str & Space(3) & a(i, j)
Next
List1.AddItem str
Next
End Sub
Private Sub CmdTranspose_Click()
List2.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
b(i, j) = a(j, i)
str = str & Space(3) & b(i, j)
Next
List2.AddItem str
Next
End Sub
Private Sub
CmdAdd_Click()
List3.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
result(i, j) = Val(a(i, j)) + Val(b(i, j))
str = str & Space(3) & result(i, j)
Next
List3.AddItem str
Next
End Sub
List3.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
result(i, j) = Val(a(i, j)) + Val(b(i, j))
str = str & Space(3) & result(i, j)
Next
List3.AddItem str
Next
End Sub
Private Sub
CmdMul_Click()
List3.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
result(i, j) = 0
For k = 0 To 2
result(i, j) = Val(result(i, j)) + Val(Val(a(k, j)) * Val(b(i, k)))
Next
Next
Next
for i = 0 To 2
str = ""
For j = 0 To 2
str = str & Space(3) & result(i, j)
Next
List3.AddItem str
Next
End Sub
Private Sub CmdExit_Click()List3.Clear
Dim str As String
For i = 0 To 2
str = ""
For j = 0 To 2
result(i, j) = 0
For k = 0 To 2
result(i, j) = Val(result(i, j)) + Val(Val(a(k, j)) * Val(b(i, k)))
Next
Next
Next
for i = 0 To 2
str = ""
For j = 0 To 2
str = str & Space(3) & result(i, j)
Next
List3.AddItem str
Next
End Sub
End Sub
Output
Note:- please set some property of your control like caption
or id corresponding to your control
Goto visual basic programs index page