i wanna store this data into an arraylist or a collection of some sort. After the data is stored i can filter the data out by the first column, im using the first column as a tag where the input came from
Main Topics
Browse All TopicsWhat is the best way to store data like this:
TEST1,input1
TEST1,input2
TEST1,input3
TEST1,input4
TEST2,input5
TEST2,input6
where inputs can either be a string object or an exception object
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Maybe a DataTable will do it for you....
Dim dt As New DataTable
dt.Columns.Add("Source")
dt.Columns.Add("Input")
Dim arr1() As String = {"TEST1", "input1"}
dt.Rows.Add(arr1)
Dim arr2() As String = {"TEST1", "input2"}
dt.Rows.Add(arr1)
Dim arr3() As String = {"TEST1", "input3"}
dt.Rows.Add(arr1)
Dim arr4() As String = {"TEST1", "input4"}
dt.Rows.Add(arr1)
Dim arr5() As String = {"TEST2", "input5"}
dt.Rows.Add(arr1)
Dim arr6() As String = {"TEST2", "input6"}
dt.Rows.Add(arr1)
'Loop through each of the records for TEST1
For Each dr As DataRow In dt.Select("[Source] = 'TEST1'")
'what ever
Next
Sorry, just realised you want to store an Exception object. Is the second field unique? If it is, use a HashTable and use the second field as the key, with the other field as the value. To filter out the first column, do something like this....
For Each v As Object In ht.Values
If v = "ITEM1" Then
'whatever
End If
Next
...where ht is the original HashTable.
Regards,
Wayne
how am I gonna make this code work. The error in the data table is either
of type exception or of type string here is the code I wrote but it need HELP!
For Each dr As DataRow In organizedErrors.Select("[S
Dim type As String = dr.GetType.Name
If type = "Exception" Then
'These lines need dr to be casted as typr exception somehow
txtTestResults.Text = txtTestResults.Text & "The code broke " & dr.StackTrace & vbCrLf
txtTestResults.Text = txtTestResults.Text & dr.Message
ElseIf type = "String" Then
txtTestResults.Text = txtTestResults.Text & dr.ToString
End If
Next
Disregard the last 2 snippets:
I got foreach wrong in this one for starters and I dont know if my cast to type
exception is gona fly....
For Each dr As DataRow In organizedErrors.Select("[S
Dim type As String = dr.Item("Error").GetType.N
If type = "Exception" Then
Dim ex As Exception = CType(dr.Item("Error"), Exception)
txtTestResults.Text = txtTestResults.Text & "The code broke " & ex.StackTrace & vbCrLf
txtTestResults.Text = txtTestResults.Text & ex.Message
ElseIf type = "String" Then
txtTestResults.Text = txtTestResults.Text & dr.ToString
End If
Next
Business Accounts
Answer for Membership
by: Marv-inPosted on 2006-12-14 at 14:09:14ID: 18142617
That is a little vague - what is the purpose?
the problem is that you can store either but would need to make the variable an object and use gettype to figure if its a string or not.
if you make a class that has a property of each and maybe a boolean prop of HasErros or somthign.