473,418 Members | 2,023 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,418 software developers and data experts.

arrayList question

How can i get an item out of an ArrayList to write to a file?
I want to add the items to a collection to write them to a file.
Nov 17 '05 #1
4 1124
NuCoder <me@me.com> wrote:
How can i get an item out of an ArrayList to write to a file?
I want to add the items to a collection to write them to a file.


Which bit are you stuck on? What kind of items are you wanting to
write, and in what format?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2
Hi,

You can serialize arraylist and write it to file as xml. Also for creating
arraylist from same xml use deserialization.
Sample:
http://www.devhood.com/tutorials/tut...utorial_id=236

I hope it helps ...

Regards,
Josip Habjan, Croatia
URL: http://www.habjansoftware.com

"NuCoder" <me@me.com> wrote in message
news:eJ**************@TK2MSFTNGP09.phx.gbl...
How can i get an item out of an ArrayList to write to a file?
I want to add the items to a collection to write them to a file.

Nov 17 '05 #3
the app was created by someone else so i'm trying to use the existing code
in it. What's happening is that the app reads a file and validates the data
in the file, if the data is invalid for any reason it writes an error to an
Error arrayList then writes those errors to an text file. BUT I know need to
write the error message to an excel file BUT I need to match the errors to
the data that it is erroring out on. When I try to write the errors to the
excel its only writing the last error.

example:
data looks like this
BMW 20051212 John Smith New
BMW 20041210 John Smith

I have rules to check this data and validate the date format, and verify the
make, name, price and new or used is there, since the price is not there an
error would be created.

"price not in file".
so i need to write
record 1 error
BMW John Smith - price not included in file

record 2
BMW John Smith - indicator 'new' or 'used' not included in file

how can i get both errors for the one record to write to my file? I get the
last error to write but not both.


"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
NuCoder <me@me.com> wrote:
How can i get an item out of an ArrayList to write to a file?
I want to add the items to a collection to write them to a file.


Which bit are you stuck on? What kind of items are you wanting to
write, and in what format?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 17 '05 #4
NuCoder <me@me.com> wrote:

<snip>
how can i get both errors for the one record to write to my file? I get the
last error to write but not both.


Well, how are you currently getting the last error? Without seeing some
of your code, it's hard to know what's going wrong.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #5

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

Similar topics

7
by: Alex Ting | last post by:
Hi Everybody, I have an issue about deleting an object from an arrayList. I've bounded a datagrid using this code where it will first run through all of the code in loadQuestions() and bind a...
3
by: george r smith | last post by:
I am trying to create an arrayList that contains multiple arrayLists. My code attempt is below. The question I have is how can I get away from creating another pAttribute list than can be added to...
10
by: C Downey | last post by:
Hello: I have an arraylist storing some very basic objects. The object is very basic, it has 2 properties : ID, and COUNT Before I add an object to the arraylist, I want to check if an...
6
by: GrandpaB | last post by:
While writing this plea for help, I think I solved my dilemma, but I don't know why the problem solving statement is necessary. The inspiration for the statement came from an undocumented VB...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
3
by: Mark Jones | last post by:
I am quite new to ASP and .Net development and I am building a web-based multiple choice exam application. The web page displays the questions using a Repeater control and the answers are nested...
11
by: Simon Says | last post by:
Hi all, I've an arraylist A1 that contains {0,1,2,3,4,5,9,8,7} I've another arraylist A2 that contains {4,5,9} I would like to search whether if A2 is present in A1 and maybe return the first...
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
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:
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.