473,322 Members | 1,614 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,322 software developers and data experts.

Getting an Array structure from Class Property

Hi,
I am creating a class. I do not have any problem defining the property
statements except when an array is involved. Would someone be able to show
me the correct syntax for a Property statement to Get an entire array
instead of one element of the array.

thanks,
hugh

Nov 21 '05 #1
2 913

....

Private _items() As String = {"AB", "CD", "EF"}

Public Property Items() As String()
Get
Return _items
End Get
Set(ByVal Value As String())
_items = Value
End Set
End Property

NOTE:
The Set property does not copy the items, it 'drops' the old array and
replaces it with the new one.
In practice I would avoid this.
A readonly property to return the array and then an Add(xxx) function
to add items to the array.

hth
Alan.

Nov 21 '05 #2
Alan,
Thanks, I agree. And was only planning a Read Only property.

hugh

<al*******@users.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...

...

Private _items() As String = {"AB", "CD", "EF"}

Public Property Items() As String()
Get
Return _items
End Get
Set(ByVal Value As String())
_items = Value
End Set
End Property

NOTE:
The Set property does not copy the items, it 'drops' the old array and
replaces it with the new one.
In practice I would avoid this.
A readonly property to return the array and then an Add(xxx) function
to add items to the array.

hth
Alan.

Nov 21 '05 #3

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

Similar topics

10
by: Dennis Myrén | last post by:
Hi. I have an array of struct. My question is, if i do: STRUCT a = new STRUCT ; STRUCT s = new STRUCT(); a = s; since STRUCT is a value type, when assigning element 0 of the STRUCT array...
26
by: Brett | last post by:
I have created a structure with five fields. I then create an array of this type of structure and place the structure into an array element. Say index one. I want to assign a value to field3 of...
7
by: Ron | last post by:
Hello, I have 4 classes that use 4 DTS packages on 4 different tables. So I have Dim cls1 As New clsDTS1, cls2 As New clsDTS2 Dim cls3 As New clsDTS3, cls4 As New clsDTS4 Each class has a...
4
by: Tad Marshall | last post by:
Hi, I'm reading about arrays in VB.NET and I seem to have a few options for my data structure. I need a multi-dimensional array of structures, and my first thought was Public Structure myStr...
8
by: Maileen | last post by:
Hi, I would like to have something like an array (something like a collection) in order to store the following things : company name1, new1, old1, in1, out1 company name2, new2, old2, in2,...
3
by: Hugh O | last post by:
Hi, I am creating a class. I do not have any problem defining the property statements except when an array is involved. Would someone be able to show me the correct syntax for a Property...
5
by: Sam | last post by:
Hi All I have couple of question regarding property of a class and structures. **** ---- Here is my class and structure ---- ***** 1. Public Structure MyPoint 2. Dim p As Point 3. ...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
10
by: Scott Townsend | last post by:
So I need to talk to a devices that expects all of the bits and bytes I sent it to be in specific places (not yet 100% defined). I wanted to create a structure/class with all of the data in it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.