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

Trouble with ArrayList

When I was working with vs 2003 I was used to do thinks like this:

ArrayList a = new ArrayList();
Doc d = new Doc();

d.field = "value";
a.Add(d);
....
((Doc)a[0]).field = "other value";
And it works very well. But now, in vs2005 it doesn't work and I don't know
why.
How can I make it works in vs2005?
Thank you very much.
Mar 21 '06 #1
4 1036
> When I was working with vs 2003 I was used to do thinks like this:

ArrayList a = new ArrayList();
Doc d = new Doc();
d.field = "value";
a.Add(d);
...
((Doc)a[0]).field = "other value";
And it works very well. But now, in vs2005 it doesn't work and I don't
know
why.
How can I make it works in vs2005?
Thank you very much.


Why do you think it doesn't work?
- compiler error? if so then we need to see the error
- exception? if so then we need to see the exception message and type
- does not give the expected results? then we need to see the declaration
of Doc, as well as an explanation of how you verify that it does what its
supposed to do

--
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2
Mar 21 '06 #2
hi,
i hope that you are in step of migration,
i have a task to migrate to VS 2005,
i hope so for you some docs or comment for
strategy to follow for that.

Cordailement,
Jouad

Mar 21 '06 #3
Hi,
...
((Doc)a[0]).field = "other value";
And it works very well. But now, in vs2005 it doesn't work and I don't
know


That should work fine, what is the error you are getting?
Mar 21 '06 #4
It was an error. I was typing ((Doc)a).field.
Thank you everybody.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
escribió en el mensaje news:OE**************@TK2MSFTNGP10.phx.gbl...
Hi,
...
((Doc)a[0]).field = "other value";
And it works very well. But now, in vs2005 it doesn't work and I don't
know


That should work fine, what is the error you are getting?

Mar 21 '06 #5

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

Similar topics

7
by: Alberto | last post by:
I have a class A who send an event when an instance is modified. So, I declared the event in this way: public delegate void Evento(object sender); public event Evento Modified; To throw the...
7
by: Mike Joseph | last post by:
I have a data file that was produced in MicroSoft Access. It's a table that was exported as a fixed format, sequential access ASCII file. It contains over 80,000 records. Basically, all the stats...
3
by: Nathan Sokalski | last post by:
I am having trouble removing cookies that I created with my site. Here is the code I am using to try and remove them: If Not Request.Cookies("username") Is Nothing Then...
2
by: eric.houghland | last post by:
Hello, I've read quite a bit about implementing this interface in .NET and believe I have a good start. I am able to use StgIsStorageFile, StgCreateStorage and StgOpenStorage. I am now...
5
by: Amoril | last post by:
I've read quite a few different message on various boards and for some reason I'm still having trouble wrapping my head around this viewstate maintenance and trying to get these dynamically created...
1
by: Doug_J_W | last post by:
I have a Visual Basic (2005) project that contains around twenty embedded text files as resources. The text files contain two columns of real numbers that are separated by tab deliminator, and are...
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
12
blazedaces
by: blazedaces | last post by:
Hello again. I'm trying to take as an input an ArrayList<String> and utilize String's .spit(delimiter) method to turn that into a String. I'm getting some kind of error though (I'll post the code...
9
by: coolieman | last post by:
Hi, Everyone, recently my programming class has started making programs involving arraylists. Our program is supposed to delete all numbers in the arraylist that contain numbers that end in the...
3
by: javalen7 | last post by:
I have some code that reads some datarows into an arraylist (called al), returns this to the calling function, and uses this as the DataSource property of a datagrid. I need to read what's in "al",...
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: 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...
0
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...
0
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...
0
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...

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.