Link to home
Start Free TrialLog in
Avatar of alfardan
alfardanFlag for United Arab Emirates

asked on

VB.NET - giving a default value to an Arraylist in a function paraments list

Hi

I have declared a function that returns to me some data, the thing is one of its parameters is an ArrayList and it's an optional parameter. check the code below.


As you see, I said {Optional ByVal Editable As ArrayList = Nothing} and it gives me an error on run time, so I thought the default value I gave to the optional arraylist is wrong, so what shall I put instead of 'Nothing'? I want it to be an arraylist of no data included if the user did not pass anything to that function.
Public Shared Function DisplayRequestMainData(ByVal Col1Contents As ArrayList, ByVal Col2Contents As ArrayList, Optional ByVal TableTitle As String = "Request Main Data", Optional ByVal Editable As ArrayList = Nothing) As String
 
[SOME CODE HERE]
 
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GuitarRich
GuitarRich
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alfardan

ASKER

Thanks, I put this condition and it worked