Param Array in

Posted by Satyapriyanayak under VB.NET category on | Points: 40 | Views : 3321
Here we will know about param array (parameter array) 

Condition of using this array
1.It must be the lone argument in the parameter declaration or it is used only once.
2.It is passed by call by value.
3.It must be the one dimensional array.
4.It must be the last argument in the parameter declaration.
5.A keyword param array is used after by val.


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sname("Student Name", "raj", "ravi", "abhijit", "rahul", "adarsh")
End Sub
Private Sub sname(ByVal s As String, ByVal ParamArray ar() As String)
Dim i As Integer
TextBox1.Text += s + vbCrLf
For i = 0 To UBound(ar)
TextBox1.Text += ar(i) + vbCrLf
End Sub
End Class

Comments or Responses

Login to post response