473,831 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5211
CType(myArray.I tem(index), MyStructvb).myP roperty = "Large!"

--
Best Regards

The Inimitable Mr Newbie º¿º


"mm" <mansj.caiway.n l> wrote in message
news:mn******** *************** *********@4ax.c om...

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.n l> wrote in message
news:0v******** *************** *********@4ax.c om...
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*******@free net.de> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
"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
14038
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.) The technical requirements: 1) Store tree data in the database so that it can be extracted as a tree structure. For test purposes,
0
1220
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 the fields of a specific result set. The user has the option to select the fields he/she wants. So the structue that is contained in the ArrayList will change on the Fly. I am not sure how to tackle this problem. Does anyone know how to...
26
7103
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 the structure inside the array. When I try this, an error about late assignment appears. Is it possible to assign a value to a structure field that is in an array? I'm currently getting around the problem by creating a new structure, assign...
7
2092
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 how I might modify a structure in an arraylist without having to completely remove it and re-add the structure to the arraylist? I just want to iterate throught the arraylist and change items based on certain conditions. Thanks in advance!
3
1985
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 and model in the textboxes, how is this done with an arraylist John --- Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
2
1111
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. See code below Structure SppElementProperties Dim Element As String Dim North As String Dim South As String
7
6798
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 = LoadOracleData(sql) '____Do amazing things
8
6628
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), unit number (int), address (int), value (int), etc. I created a structre to handle each element. Since there is an unknown number of rows I have used an arraylist to hold it. This works using the arraylist.add(structure). The problem is that after...
1
3281
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 Control to an Array of Objects or Structures by http://support.microsoft.com/?id=315784 316302 HOW TO: Bind a DataGrid Control to an ArrayList of Objects or Structures http://support.microsoft.com/?id=316302
0
9642
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
10494
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10534
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
10208
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...
1
7748
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
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4417
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
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.