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

Array in a property

Q
Hello to the pro's,

I want to use an array in a class. This array should be visible as a
property.
Just can't seem to find out how to do it.
Maybe there are other (and more easy) solutions?
Can anyone help me??

Regards,

Q

Jul 31 '07 #1
3 23001
"Q" <Q@nomail.netschrieb
Hello to the pro's,

I want to use an array in a class. This array should be visible as a
property.
Just can't seem to find out how to do it.
Maybe there are other (and more easy) solutions?
Can anyone help me??

Regards,
Either make the Array a Public Readonly field, or:

Private f_Items(17) As Integer

Public Property Item(ByVal Index As Integer) As Integer
Get
Return f_Items(Index)
End Get
Set(ByVal value As Integer)
f_Items(Index) = value
End Set
End Property
Armin
Jul 31 '07 #2
you probably need something like:

Public MyArray() As String

Public MyList() As List(Of String)

second is much better. If you also need set/get (less common)
implement it as a "property".
"String" can be replaced with any type.

Tommaso
On 31 Lug, 11:46, "Q" <Q...@nomail.netwrote:
Hello to the pro's,

I want to use an array in a class. This array should be visible as a
property.
Just can't seem to find out how to do it.
Maybe there are other (and more easy) solutions?
Can anyone help me??

Regards,

Q

Jul 31 '07 #3

"Q" <Q@nomail.netwrote in message
news:eV**************@TK2MSFTNGP02.phx.gbl...
Hello to the pro's,

I want to use an array in a class. This array should be visible as a
property.
Just can't seem to find out how to do it.
Maybe there are other (and more easy) solutions?
Can anyone help me??

-------------

The array or arraylist should be Private

But the Property Get and Set for an item of the array should be Public.

You'll see the example in the links

http://www.developerfusion.co.uk/show/1047/2/
http://www.java2s.com/Code/VB/Data-S...urownclass.htm

Jul 31 '07 #4

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

Similar topics

8
by: point | last post by:
Hi there.. I have the folowing array => property = hexonet => property = 2003-12-01 18:46:20.0 => property = hexonet => property = 2003-12-02 02:59:15.0 => property = hexonet =>...
5
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
22
by: VK | last post by:
A while ago I proposed to update info in the group FAQ section, but I dropped the discussion using the approach "No matter what color the cat is as long as it still hounts the mice". Over the last...
35
by: VK | last post by:
Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html>
7
by: Robert Mark Bram | last post by:
Hi All! How do you get the length of an associative array? var my_cars= new Array() my_cars="Mustang"; my_cars="Station Wagon"; my_cars="SUV"; alert(my_cars.length);
5
by: Jon Maz | last post by:
Hi All, I'm reasonably proficient with C#, and am starting with php5. I was happy to learn of the __get and __set methods, but am encountering a problem using them to set an object property of...
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
2
by: JJA | last post by:
I'm looking at some code I do not understand: var icons = new Array(); icons = new GIcon(); icons.image = "somefilename.png"; I read this as an array of icons is being built. An element of...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.