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

structure and arraylist

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
Dec 3 '05 #1
6 5187
CType(myArray.Item(index), MyStructvb).myProperty = "Large!"

--
Best Regards

The Inimitable Mr Newbie º¿º


"mm" <mansj.caiway.nl> wrote in message
news:mn********************************@4ax.com...

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

Dec 3 '05 #2
mm
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
Dec 4 '05 #3
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.

--
Best Regards

The Inimitable Mr Newbie º¿º
"mm" <mansj.caiway.nl> wrote in message
news:0v********************************@4ax.com...
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

Dec 4 '05 #4
"Mr Newbie" <he**@now.com> schrieb
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

Dec 4 '05 #5
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.

--
Best Regards

The Inimitable Mr Newbie º¿º
"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
"Mr Newbie" <he**@now.com> schrieb
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

Dec 4 '05 #6
"Mr Newbie" <he**@now.com> schrieb
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

Dec 5 '05 #7

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

Similar topics

3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
0
by: Duncan | last post by:
It is on WINCE. But should not matter. I am binding a datagrid to a ArrayList using the datasource property of the datagrid. ArrayList will contain data structures. The data structure contains all...
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: Adam | last post by:
Hi all, In my VB.NET code below, I try to change the user name in my arraylist from Ted to Bob, but instead it adds a new user to the arraylist named Bob. Can anyone explain why this happens and...
3
by: RBCC | last post by:
I have a form with a listbox and two textboxes. In the listbox I have the make and models of automobiles. and as the user clicks on the make of the car in the listbox I would like to output the make...
2
by: sal | last post by:
Greetings All I'm learning to use arraylist and structures but I'm getting a System.NullReferenceException Error and I'm not sure why. I followed the VB.net book all I did was change the names....
7
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al =...
8
by: wg | last post by:
I have worked on this for a while and have not been able to get it working. I seem to be missing something. What I am attempting to do is get information from a csv file such as: name (stirng),...
1
by: =?Utf-8?B?SmF5Qw==?= | last post by:
I am trying to understand how to use an arraylist that contains data in a structure and bind the results to a gridview. Using vs2008 I have looked at the examples 315784 HOW TO: Bind a DataGrid...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.