vks.gautam1
Well-known member
Double dimensional array in class
--------------------------------------------------------------------------------
Here i want to that user enter marks of 2 students.
I want to show the sum of marks of both the students seperately in list box.
Form on button click
class code
--------------------------------------------------------------------------------
Here i want to that user enter marks of 2 students.
I want to show the sum of marks of both the students seperately in list box.
Form on button click
VB.NET:
Public Class frmSum
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim i, j, result, no(1, 1) As Integer
'Declare the Object of Class Sum
Dim objsum As SUM
objsum = New SUM
For i = 0 To 1
For j = 0 To 1
no(i, j) = InputBox("Pls enter No ")
no(i, j) = no(i, j)
Next
Next
result = objsum.funsum(no)
'Add the result in ListBox
lstResult.Items.Add(result)
End Sub
End Classclass
class code
VB.NET:
Public Class SUM
Public Function funsum(ByVal no(,) As Integer) As Integer
Dim result(1), i, j As Integer
For i = 0 To 1
For j = 0 To 1
result(i) = no(i, j) + result(i)
Next
Next
Return result(i)
End Function
End Class