Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Int16, y As Int16
x = CInt(TextBox1.Text)
y = CInt(TextBox2.Text)
add(10, 20)
End Sub
Private Sub add(Of T)(ByVal x As T, ByVal y As T)
Dim res As T
res = x + y
MsgBox(res)
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x As Double, y As Double
x = CDbl(TextBox1.Text)
y = CDbl(TextBox2.Text)
add(4.5, 5.6)
End Sub
This is the code i used but there is an error " Operator + not defined for datatype 'T' and 'T' ". what is wrong in this. thanks in advance