structure and arraylist

  • Thread starter Thread starter mm
  • Start date Start date
M

mm

Hi All,

I am a newbie in Vb.net and I have some problems
I have a structure called padrecord.
In this structure i have X,Y len h w name typeval
First I add the known values in X and Y.
And put then this structure in a Arraylist
Afterwards I want to add the values of len h name and typeval to all
the padrecords in the arraylist
The count of items in the arraylist can be between 1 and 5000
How do I do this

TIA

Mans
 
Hi All,

I have still problems with storage an changing the values afterwards

Public Structure padRecord
Public w As Double ' Width
Public h As Double ' Height
Public lw As Double ' Width line
Public lh As Double ' Height line
Public line As Boolean ' Line
Public x As Double ' X position
Public y As Double ' Y postition
Public deg As Integer ' Degrees (0/90)
Public ldeg As Integer ' Line Degrees (0/90)
Public typeval As String ' Type (SQ/R)
Public name As String ' Name
End Struct
Dim Padstacks as new Arraylist

And i have a textfile wich contains the values for the (5000)
structures above
The values of one structure are not available on the same time.
And afterwards I will write the values to another textfile with a
different format
The questions are how do I storage all the values into a arraylist and
how do I get them out

Mans
 
Ive replied already to this, perhaps you could read this.

The arraylist stores objects, but you need to do a type conversion when you
access those objects because at design time you cannot predict what object
type it will be.
 
Mr Newbie said:
Ive replied already to this, perhaps you could read this.

The arraylist stores objects, but you need to do a type conversion
when you access those objects because at design time you cannot
predict what object type it will be.


You cannot change the objects in the Arraylist if they are structures. Use a
class instead.


Armin
 
No. You misunderstand me. What I mean was that you cannot reference the
members of the class without knowing what the type is so you need to use a
CType in order to write your code.
 
Mr Newbie said:
No. You misunderstand me. What I mean was that you cannot reference
the members of the class without knowing what the type is so you
need to use a CType in order to write your code.


It's not a class but a structure. Therefore you can not change the
properties of the items in the arraylist because it's a value type. If it
was a class, your code would work.


Armin
 
Back
Top