troubleshooting Question

Data organization issue

Avatar of sammySeltzer
sammySeltzerFlag for United States of America asked on
ASP.NETVisual Basic.NET* DataGridView.NET Programming
7 Comments1 Solution180 ViewsLast Modified:
Greetings again mates.

When I run the following code:

If dtCurrentTable.Rows.Count > 0 Then
                '//Next collection. Spouse Information
                For Each row As DataRow In dtCurrentTable.Rows

                    Dim txtsourcen As String = TryCast(row.ItemArray(1), String)
                    Dim txtsourcea As String = TryCast(row.ItemArray(2), String)
                    Dim txtsourcei As String = TryCast(row.ItemArray(3), String)

                    lblPreviewSourceName.Text += txtsourcen & "<br />"
                    lblPreviewSourceAddress.Text += txtsourcea & "<br />"
                    lblPreviewIncomeSource.Text += txtsourcei & "<br />"

                    'get the values from the TextBoxes

                    'then add it to the collections with a comma "," as the delimited values

                    sc.Add(lblPreviewSourceName.Text + "," + lblPreviewSourceAddress.Text + "," + lblPreviewIncomeSource.Text)
                    rowIndex += 1
, I get this result and the way it is presented.

Name: Ivory West
Indiana Jones

Address: 20 Ivory Street
65 Kay Dr

Income: 1000001

I am getting that result because we are dynamically creating rows. In this case, there are two rows relating to same field names.

I would like the data to be presented in the following format:

Name: Ivory West
Address: 20 Ivory Street
Income: 1000001

Name: Indiana Jones
Address: 65 Kay Dr
Income: 5820000 

What do I need to change in the code I posted to get this type of lay out?

Thank you.
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros