sammySeltzer
asked on
Data organization issue
Greetings again mates.
When I run the following code:
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:
What do I need to change in the code I posted to get this type of lay out?
Thank you.
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
Next
, I get this result and the way it is presented.Name: Ivory West
Indiana Jones
Address: 20 Ivory Street
65 Kay Dr
Income: 1000001
5820000
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.
ASKER
Thank you Ryan.
It is very close to the solution I am looking for.
Please see screenshot of what I am getting.
I have circled the one little issue to need to be addressed.
The results is what I am looking for but it leaves an extra Address and Income text.
needre.png
It is very close to the solution I am looking for.
Please see screenshot of what I am getting.
I have circled the one little issue to need to be addressed.
The results is what I am looking for but it leaves an extra Address and Income text.
needre.png
i believe what you highlighted was generated by label controls: lblPreviewSourceAddress and lblPreviewIncomeSource.
you can try to set its value to "" or directly remove it if they're unused.
you can try to set its value to "" or directly remove it if they're unused.
ASKER
I believe you meant this line:
I was thinking the same thing and so I removed them and changed that line to this:
but they are still there. That's why I posted back because I am not sure what else could be causing.
sc.Add(lblPreviewSourceName.Text + "," + lblPreviewSourceAddress.Text + "," + lblPreviewIncomeSource.Text)
I was thinking the same thing and so I removed them and changed that line to this:
sc.Add(lblPreviewSourceName.Text)
but they are still there. That's why I posted back because I am not sure what else could be causing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I removed those from the HTML markup and seems good enough; just some cosmetic stuff that I will work out.
Thank you for your help.
Thank you for your help.
ASKER
Thank you
hence, you may just need to use one label with this code: (not really tested, you may customize accordingly)
Open in new window