Hi all,
I am facing one problem with callbyName. I am facing one problem, instead
of describing this I am pasting this code. I wanted to know is there any
other way to avoid this error and make generalized functions.
Please see the code.
Regards,
Kishor
Module Module1
Sub Main()
Dim pp1 As String = "Kishor"
Dim pp2 As String = "Ashish"
Dim pp3 As String = "Darshan"
Dim ppx1() As String = {"Kishor", "Rajeev", "Sonia"}
Dim ppx2() As String = {"Varsa", "Jassi", "Dahi bada"}
Dim ppx3() As String = {"MPK", "QSQT", "HAHK", "K3g", "PYTKK"}
Dim oc As New mycls()
'CallByName(oc, "TwoSingleParam", CallType.Method, pp1, pp2)
'CallByName(oc, "TwoArrayParam", CallType.Method, ppx1, ppx2)
'CallByName(oc, "OneSingleParam", CallType.Method, pp1)
CallByName(oc, "OneArrayParam", CallType.Method, ppx2)
'CallByName(oc, "ThreeArrayParam", CallType.Method, ppx1, ppx2, ppx3)
End Sub
Public Class mycls
Public Sub TwoSingleParam(ByVal p1 As String, ByVal p2 As String)
MsgBox(p1 & "..........." & p2)
End Sub
Public Sub TwoArrayParam(ByVal p1() As String, ByVal p2() As String)
Dim i As Integer
For i = 0 To UBound(p1)
MsgBox(p1(i) & " " & p2(i))
Next
End Sub
Public Sub OneSingleParam(ByVal p1 As String)
MsgBox(p1)
End Sub
Public Sub OneArrayParam(ByRef p1() As String)
Dim i As Integer
For i = 0 To UBound(p1)
MsgBox(p1(i))
Next
End Sub
Public Sub OneArrayParamxx(ByRef p1 As String, ByRef p2 As String,
ByRef p3 As String)
MsgBox(p1 & "" & p2 & "" & p3)
End Sub
Public Sub ThreeArrayParam(ByVal p1() As String, ByVal p2() As
String, ByVal p3() As String)
Dim i As Integer
MsgBox("chal gaya 1a")
For i = 0 To UBound(p1)
MsgBox(p1(i))
Next
For i = 0 To UBound(p2)
MsgBox(p2(i))
Next
For i = 0 To UBound(p3)
MsgBox(p3(i))
Next
End Sub
End Class
End Module