Reading xml data to listbox w/ linefeed as requirement

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi... Id like to read from an xml file into a listbox where the incoming text (of varying length) should include a crlf control.
Incoming text from Main.xml file looks like below as copied from notepad:

<?xml version="1.0" encoding="utf-8"?>
<Rows> _
<Row Sortorder="1 <Supplier Deleteme="false abc
defghi
jklmnopq
rstuvwxyz</Supplier>

_
</Rows>


Code Im testing looks like:

Dim doc = XDocument.Load("Main.xml")
Dim s As Short = 0
Dim tbs As String

For Each row In doc...<Row>
s = s + 1
tbs = row...<Supplier>.Value

If s = 1 Then
Me.ListBox1.Items.Add(tbs)
End If
Next

Test Result as displayed in listbox:
abcdefghijklmnopqrstuvwxyz

Need Listbox to display:
<span style="font-weight:normal
abc
defghi
jklmnopq
rstuvwxyz

Thanks in advance for your assistance.





View the full article
 
Back
Top