473,434 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

How to declare array as optional in function using VB.Net

pentahari
My function is:

Function test(optional ByVal arr1() as System.Array)

End Function


how to declare the array as optional?
i know that optional variable must be constant value, but i don't know the constant value to the array
Dec 20 '07 #1
3 11897
Frinavale
9,735 Expert Mod 8TB
My function is:

Function test(optional ByVal arr1() as System.Array)

End Function


how to declare the array as optional?
i know that optional variable must be constant value, but i don't know the constant value to the array
Try:
Function Test(Optional ByVal Arr1 As Array = Nothing)
Dec 20 '07 #2
shweta123
692 Expert 512MB
Hi,

Try like this

Function test(optional ByVal arr1() as System.Array = nothing)

End Function

My function is:

Function test(optional ByVal arr1() as System.Array)

End Function


how to declare the array as optional?
i know that optional variable must be constant value, but i don't know the constant value to the array
Dec 20 '07 #3
Frinavale
9,735 Expert Mod 8TB
Hi,

Try like this

Function test(optional ByVal arr1() as System.Array = nothing)

End Function
The only thing I'm not too sure about is the arr1() as System.Array.
Doesn't this pass into the function an array of arrays?

Wouldn't you then want to use an ArrayList?

I could be wrong...so feel free to correct me here :)
Dec 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
2
by: _andrea.l | last post by:
I'd like to roder an array: $array $array $array I'd like to order $array by name or by numbre of by a function($array,$array) that return 1 or -1 if id1 is less tha id2 or viceversa... How...
11
by: deko | last post by:
I need to create a basic one-dimensional array of strings, but I don't know how many strings I'm going to have until the code is finished looping. pseudo code: Dim astrMyArray() Do While Not...
15
by: Geoff Cox | last post by:
Hello, Can I separately declare and initialize a string array? How and where would I do it in the code below? It was created using Visual C++ 2005 Express Beta 2 ... In C# I would have ...
2
by: Urs van Binsbergen | last post by:
Hi! This sounds probably quite silly, but I just can't figure out this one. Consider the following which lets "a" be an array with 0 elements: Dim a() As Integer a = New Integer() {} Now...
4
by: shachar | last post by:
hi all. i'm looking for a simple example of how to pass optionaly, an array to a function. if the array isn't there (it's optional) i want to know about it. thanks.
4
by: John | last post by:
Hi I need to return an array of string in my own split function (access 97). I have defined the function as below but I get err on 'As String()'. What can I do to make the function return an...
3
by: Brian S. | last post by:
Hi, I am wondering how i can pass an array as an optional parameter to a function?
18
by: dhtml | last post by:
Array.splice({}) What should it do? I think it should return a new Array with length 0. Array.splice(arr, start, deleteCount ]]) http://bclary.com/2004/11/07/#a-15.4.4.12 Example:
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.