473,805 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to return array of object

Ali
hi i need to send some data to the function and want to return array of object bac
lik

dim obj() as myclass=AddIt(i ,j
i dont know that is write syntax or no

public function addit(byval i as interger, byval j as integer) as myclas
dim obj(20) as myclas
obj(0).additem( i,j
obj(1).additem( i,j
Nov 20 '05 #1
2 1703
* =?Utf-8?B?QWxp?= <an*******@disc ussions.microso ft.com> scripsit:
hi i need to send some data to the function and want to return array of object back
like

dim obj() as myclass=AddIt(i ,j)
i dont know that is write syntax or not

public function addit(byval i as interger, byval j as integer) as
myclass
'... As MyClass()'.
dim obj(20) as myclass
obj(0).additem( i,j)
obj(1).additem( i,j)
.
.
obj(20).additem (i,j)
'obj(i) = ...'.
return obj
end function
if some body give me help how to do that


--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
You should add parenthesis to the return object...
Syntax sample below

Your implmentation of AddIt
public function addit(byval i as interger, byval j as integer) as myclass

Corrected AddIt
Public Function AddIt(ByVal i As Integer, ByVal j As Integer) as myClass()

Hope it helps
--

Poolbeer (MCP)

"Ali" <an*******@disc ussions.microso ft.com> wrote in message
news:57******** *************** ***********@mic rosoft.com...
hi i need to send some data to the function and want to return array of object back like

dim obj() as myclass=AddIt(i ,j)
i dont know that is write syntax or not

public function addit(byval i as interger, byval j as integer) as myclass
dim obj(20) as myclass
obj(0).additem( i,j)
obj(1).additem( i,j)
.
.
obj(20).additem (i,j)
return obj
end function
if some body give me help how to do that

Nov 20 '05 #3

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

Similar topics

2
18669
by: Asad Khan | last post by:
Hello, I am writing a method that returns an array as an Object. Initially there is a single dimension array Object X. However, I can insert other arrays as Objects in X, thus I can end up with something like following: ------------------------ | A | B | C | Null | D | ------------------------ | R |
5
2940
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 }
8
3275
by: M. Moennigmann | last post by:
Dear all: I would like to write a function that opens a file, reads and stores data into an 2d array, and passes that array back to the caller (=main). The size of the array is not known before opening to the file. I fail to write a function that allocates memory for a 2d array and returns it to main. I was trying to pass a pointer to the array back to main, but main cannot access the data. The simplified code (no opening of file, but...
0
1528
by: JL_327 | last post by:
No one on any of the other boards seem to know In VB.Net this late binding works fine Dim Version As Integer Dim Revision As Integer Dim Wnum As Integer Dim o As System.Array = System.Array.CreateInstance (GetType(Single), 1)
1
2493
by: Pradeep Kumar | last post by:
I have a scenario where I am writing a property(using get and set) have to return a member of an object stored in an array of objects! The class user has to pass an index based on which a object i's member is returned from the array. How will the property be declared in C#?
7
1810
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...
4
1726
by: yxq | last post by:
In VB2005. Dim a() As Object = {10, 4} Dim b() As Byte = {10, 4} MessageBox.Show(a.Equals(b)) Why return False, but not Ture? Thank you
19
1949
by: Andrew Gentile | last post by:
Hello, I have been working on a program where I need to have a function return an array. I found out that C doesn't do this, so now I am trying to get the function to return a pointer to an array. It seems easy, but I keep running into the same problem. The function appears to execute properly, but when I print out the array values, only the first one is correct. The other are all wrong. A snippet of code is below. Please take a...
20
9009
by: Andrew Morton | last post by:
Is it possible to have two function declarations which take the same parameters but return different types depending on how the function is used? function f(x) as string ' return a string end function function f(x) as string() ' return an array of strings end function
3
1699
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I have a simple question. I have a function that I want to return an array. I want the array to be other objects that were instantiated in the function itself. What's the correct way to return the array? Here's what I would like to happen... public object MyFunc() { object obj1 = SomeOtherFunc1();
0
9596
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,...
0
10604
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, 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...
1
10361
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10103
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 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...
0
9179
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
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 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...
0
5536
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...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
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 we have to send another system

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.