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

ArrayList question

I am populating an arraylist from a text file on my PC. I am using this
information with C# to perform actions against a PCOM session. A for
loop handles the actions to perform. If for some reason the action
fails using one of the items in the arraylist the loop continues until
the last item in the arraylist is reached.
What I need to do is somehow annotate those items that were
successfully automated so that any items that excepted could be handled
manually.
What is the best way of handling this?
Write back to the array with a success indicator?
Write unsuccessful items to another outputfile?
???

Thanks
Steve

Nov 17 '05 #1
2 1214
keys4worship <st*****@gmail.com> wrote:
I am populating an arraylist from a text file on my PC. I am using this
information with C# to perform actions against a PCOM session. A for
loop handles the actions to perform. If for some reason the action
fails using one of the items in the arraylist the loop continues until
the last item in the arraylist is reached.
What I need to do is somehow annotate those items that were
successfully automated so that any items that excepted could be handled
manually.
What is the best way of handling this?
Write back to the array with a success indicator?
Write unsuccessful items to another outputfile?
???


I'd create another ArrayList, and when you hit an unsuccessful item,
add it to that ArrayList. Depending on your situation, you may of
course need to persist that to a file.

--
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
This definitely not exactly what you are looking for, but it should get you
on the right path.

private void BuildArrayList()
{
arraylist myArray = new arraylist();
// code to read in your data
while(data.read())
{
try
{
// the data I am adding is just some arbitary junk
// you will have to put in the info you want
myArray.Add(data(0));
}
catch (exception ex)
{
// this will load any items that are "automated"
// by catching the exception thrown and adding
// a handled item in the list
myArray.Add("Exception Item");
}
}
}

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
keys4worship <st*****@gmail.com> wrote:
I am populating an arraylist from a text file on my PC. I am using this
information with C# to perform actions against a PCOM session. A for
loop handles the actions to perform. If for some reason the action
fails using one of the items in the arraylist the loop continues until
the last item in the arraylist is reached.
What I need to do is somehow annotate those items that were
successfully automated so that any items that excepted could be handled
manually.
What is the best way of handling this?
Write back to the array with a success indicator?
Write unsuccessful items to another outputfile?
???


I'd create another ArrayList, and when you hit an unsuccessful item,
add it to that ArrayList. Depending on your situation, you may of
course need to persist that to a file.

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

Nov 17 '05 #3

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: 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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.