I need to return a nested string array from a function and am getting hung
up on syntax. Here's a simple example of a function that returns the array
and how I'm trying to call it.
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Dim arr()() As String = Me.TestArr1
End Sub
Private Function TestArr1() As String
Dim arr()() As String = { _
New String() {"a00"}, _
New String() {"a10", "a11"}, _
New String() {"a20", "a21",
"a22"}}
End Function
Any help would be great!
Thanks.
-- mo*******@nospa m.com 1 1153
Moondaddy,
Remember that:
Dim arr()() As String
is the same as:
Dim arr As String()()
This second syntax is required for function & property return types, amoung
other things.
So your TestArr1 function becomes: Private Function TestArr1() As String()() Dim arr()() As String = { _ New String() {"a00"}, _ New String() {"a10", "a11"}, _ New String() {"a20", "a21", "a22"}}
Return arr End Function
Hope this helps
Jay
"moondaddy" <mo*******@nosp am.com> wrote in message
news:e2******** ********@TK2MSF TNGP10.phx.gbl. ..I need to return a nested string array from a function and am getting hung up on syntax. Here's a simple example of a function that returns the array and how I'm trying to call it.
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button2.Click Dim arr()() As String = Me.TestArr1 End Sub
Private Function TestArr1() As String Dim arr()() As String = { _ New String() {"a00"}, _ New String() {"a10", "a11"}, _ New String() {"a20", "a21", "a22"}} End Function
Any help would be great!
Thanks.
-- mo*******@nospa m.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve |
last post by:
Hello (and a happy new year)
I'm quite new to C++ and have to programm something for school and can't
get my head around
a couple of things, but at the moment this one is the most important for me:
I have defined a class String and before I go on I should mention that
I'm not allowed to use any pre-defined templates (no STL) and not the
standard C++ String class, kind of mean :)
|
by: Andrew Poulos |
last post by:
If I'm searching for an occurance of a value in a multi-dimensional
array how can I get it's index returned as an array, if found? For
example, if:
foo = new Array();
foo = , 5, , 9, 10];
Array.prototype.findValue = function(val) {
// blah
}
|
by: Nascimento |
last post by:
Hello,
How to I do to return a string as a result of a function.
I wrote the following function:
char prt_tralha(int num)
{
int i;
char tralha;
|
by: CeZaR |
last post by:
Hi,
How can i specify the return type of a function returning a managed array of chars.
If i try to write: "char __gc func()" i get an error!
How can i do that?
Thanks!
|
by: Woody Splawn |
last post by:
How would I pass an array back to a sub routine from a function? That is, I
have a function that looks like this
Public Function arrayTest() As Array
Dim states() As String = { _
"AZ", "CA", "WA" _
}
Return states
End Function
| |
by: Agnes |
last post by:
Can combo box return more that 1 item ??
for my currency combo box, short_code, descripiton, currency rate.
as user choose the description, I need to get both short_code & currency
rate result.
Thanks
|
by: nafri |
last post by:
hello all,
I want to create a function that returns the first element of the Array
that is input to it. However, the Input Array can be an Array of points,
double, or anyother type, which means the return type of the function depends
on the type of the objects the Input array holds.
I can have the return type as Object, but it has problems like late binding
and more importantly the client has to always Cast it. For example.
class...
|
by: Pedro Pinto |
last post by:
Hi there once more........
Instead of showing all the code my problem is simple.
I've tried to create this function:
char temp(char *string){
alterString(string);
return string;
|
by: =?Utf-8?B?Um9nZXIgVHJhbmNoZXo=?= |
last post by:
Hello,
I have a question about the infamous GOTO statement and the way to return a
result from a sub:
I have a sub that has to make some calls to external COM methods, and
because these methods can fail I have to check them to be running ok, like
this:
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |