473,511 Members | 12,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing arrays between classes

Rik
Hi,

I have an Multithreaded application in VB.NET.
I inherited a Sub Class and which define an Array variable of string in that
Sub
Class.

Now I want to Carry that Sub Class Array back to the Calling Class??
without using Function Return.
Can any one Help me in this regard.
Thanks in Advance for Help

Rik
Nov 21 '05 #1
7 1818
Hello Rik,

You can pass the array using the ByRef keyword.If you pass a variable
argument by reference
using the ByRef keyword, the procedure can modify the variable itself or in
this case, the array.
So, any changes that are made in the any class will be permanent and would
be reflected in the calling class.

You can refer to following details for more details:

[Argument Passing ByRef]
http://msdn.microsoft.com/library/de...yreference.asp

HTH

Mona

"Rik" <ri********@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I have an Multithreaded application in VB.NET.
I inherited a Sub Class and which define an Array variable of string in
that Sub
Class.

Now I want to Carry that Sub Class Array back to the Calling Class??
without using Function Return.
Can any one Help me in this regard.
Thanks in Advance for Help

Rik

Nov 21 '05 #2
Rik,

I am curious why don't you want to use the return, can you tell us that, can
be an interesting reason, I never saw one for that?

(Although I know one when I don't use a function however a sub, but that is
than a little bit more complicated in a multithreading operation and loose
than probably all the sense for that multithreading operation).

Cor
Nov 21 '05 #3
Rik
Mona,

Thanks for your reply. I have to look into this option, although I am aware
of it, but will deeply study it.
Core.
Thanks for your reply too.
Functions only return one value, and that is already being used. where I am
going to send my Array back to the calling......
I don't want to change the whole Program logic due to that.Not a good IDEA,
need your thoughts on it?
I also thought that why not I included that first value part of the array
list, but for that also i need to change all my logic or handling in
Calling.....

I appriciate all your responses.


"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk*************@TK2MSFTNGP09.phx.gbl...
Rik,

I am curious why don't you want to use the return, can you tell us that,
can be an interesting reason, I never saw one for that?

(Although I know one when I don't use a function however a sub, but that
is than a little bit more complicated in a multithreading operation and
loose than probably all the sense for that multithreading operation).

Cor

Nov 21 '05 #4
Rik
I finally Solved it.
Mona Thanks your Tips Works.
Cor, Thanks for your HELP too.

Kind Regards,
Rik

"Rik" <ri********@yahoo.com> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
Mona,

Thanks for your reply. I have to look into this option, although I am
aware of it, but will deeply study it.
Core.
Thanks for your reply too.
Functions only return one value, and that is already being used. where I
am going to send my Array back to the calling......
I don't want to change the whole Program logic due to that.Not a good
IDEA, need your thoughts on it?
I also thought that why not I included that first value part of the array
list, but for that also i need to change all my logic or handling in
Calling.....

I appriciate all your responses.


"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk*************@TK2MSFTNGP09.phx.gbl...
Rik,

I am curious why don't you want to use the return, can you tell us that,
can be an interesting reason, I never saw one for that?

(Although I know one when I don't use a function however a sub, but that
is than a little bit more complicated in a multithreading operation and
loose than probably all the sense for that multithreading operation).

Cor


Nov 21 '05 #5
Rik,

When you pass an array, than you don't need to have a return value because
you are passing its reference by value.(Be aware that when you create it new
in the method you have to take a little bit other approach).

Cor
Nov 21 '05 #6
Rik
Cor,
Sorry for late reply.
I was away.
Just solved it by declaring the local arraylist and passing that arraylist
to another class and getting back the values.

It is working fine yet, but I know ur experience thought are looking beyond
my eyes.
Could you please inform me the danger which I might be facing in future
regarding that technique.

I realy appriciate your help.

Thanks in advance..

Rik

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Rik,

When you pass an array, than you don't need to have a return value because
you are passing its reference by value.(Be aware that when you create it
new in the method you have to take a little bit other approach).

Cor

Nov 21 '05 #7
Rik,
Could you please inform me the danger which I might be facing in future
regarding that technique.

Sorry Rik, no I cannot do that. For me it is as well, when it is working and
I tested something good, it is working. I cannot see what can be a danger in
future because someting that can happen I don't know.

:-)

Cor
Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

58
10050
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
19
1734
by: Method Man | last post by:
I understand that arrays and structs can't be passed by value into and out of functions since they can be arbitrarily big. My question is: Why are types allowed to be passed by value? Couldn't my...
9
4766
by: justanotherguy63 | last post by:
Hi, I am designing an application where to preserve the hierachy and for code substitability, I need to pass an array of derived class object in place of an array of base class object. Since I...
8
4095
by: kalinga1234 | last post by:
there is a problem regarding passing array of characters to another function(without using structures,pointer etc,).can anybody help me to solve the problem.
1
3428
by: Kurt Richardson | last post by:
Hi all Sorry to bother you with what is probably a really trivial question for you C++ experts. My programming skill are pretty amateur, but I'm pretty good at VB.NET. However, I'm wanting to...
1
1509
by: Steve Baer | last post by:
I'm wrapping some unmanaged C++ classes with managed versions for use in the ..NET world. Everything is going great except I can't figure out a good method for passing simple data type arrays into...
3
3773
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes...
17
3659
by: mr.resistor | last post by:
hey i am having a few problems calling a C DLL from C#. i am using a simple function that takes an array of floats and an integer as an input, but i cannot seem to get it to work. when i try to...
17
7211
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
7251
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
7148
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
7430
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
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
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...
0
4743
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...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.