|
-
May 17th, 2012, 04:32 PM
#1
Thread Starter
Member
[RESOLVED] ListView
I have the attached result in ListView and would like to separate the words by commas to make them readable. Can code be added to do this and if so where? Thanks for any help.
-
May 17th, 2012, 04:58 PM
#2
This pattern in common to all great programmers I know: they're not experts in something as much as experts in becoming experts in something.
The best programming advice I ever got was to spend my entire career becoming educable. And I suggest you do the same.
-
May 17th, 2012, 05:10 PM
#3
Re: ListView
you could use regex.
do you have a list of the unique (distinct) words that each listviewitem might contain?
also... that looks more like a listbox than a listview
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 17th, 2012, 05:20 PM
#4
Thread Starter
Member
Re: ListView
 Originally Posted by .paul.
you could use regex.
do you have a list of the unique (distinct) words that each listviewitem might contain?
also... that looks more like a listbox than a listview

It is listview. The words can be any or all of those in the attachment.
-
May 17th, 2012, 05:31 PM
#5
Re: ListView
Looks like a separation at each Capitol Letter with the exception of Sci-Fi, hence leaving words that have hyphens alone - and treated as one word.
-
May 17th, 2012, 05:49 PM
#6
Re: ListView
And there is also "Science Fiction" making things even more complicated. Before entering on how to create an AI that splits your words back, may I ask.. why are you adding them concatenated like that to the LV?
-
May 17th, 2012, 08:10 PM
#7
Thread Starter
Member
Re: ListView
 Originally Posted by jcis
And there is also "Science Fiction" making things even more complicated. Before entering on how to create an AI that splits your words back, may I ask.. why are you adding them concatenated like that to the LV?
The info is extracted from an xml file
-
May 17th, 2012, 08:20 PM
#8
Re: ListView
can you post your code? there's got to be a simpler way, before you add the items to the listview
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 17th, 2012, 08:28 PM
#9
Re: ListView
 Originally Posted by .paul.
can you post your code? there's got to be a simpler way, before you add the items to the listview
I agree. I would not like to see a Listview used in this way anyhow
-
May 17th, 2012, 08:48 PM
#10
Thread Starter
Member
Re: ListView
Here is the code:
code.txt
-
May 18th, 2012, 12:36 AM
#11
Re: ListView
Can you attach the movie.xml file this program of yours operates with?
-
May 18th, 2012, 08:56 AM
#12
Thread Starter
Member
Re: ListView
Sample movie.xml attached
movie.xml
-
May 18th, 2012, 09:09 AM
#13
Re: ListView
try this:
vb Code:
Dim lvi As New ListViewItem(xml.SelectSingleNode("Title/LocalTitle").InnerText)
lvi.SubItems.Add(String.Join(", ", Array.ConvertAll(xml.SelectNodes("Title/Genres/Genre").Cast(Of XmlNode).ToArray, Function(n) n.InnerText)))
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 18th, 2012, 09:21 AM
#14
Thread Starter
Member
Re: ListView
 Originally Posted by .paul.
try this:
vb Code:
Dim lvi As New ListViewItem(xml.SelectSingleNode("Title/LocalTitle").InnerText)
lvi.SubItems.Add(String.Join(", ", Array.ConvertAll(xml.SelectNodes("Title/Genres/Genre").Cast(Of XmlNode).ToArray, Function(n) n.InnerText)))
Thanks that worked. However when I save to Excel, each Genre is in a separate column. Is there a way to have the same appearance as in listview or would I have to adjust manually?
-
May 18th, 2012, 09:27 AM
#15
Re: ListView
the problem is that you're saving your listview contents as excel CSV + the delimiter in a csv file is a comma.
therefore excel sees that 1 field as several. use a semi colon ; instead of a comma:
vb Code:
Dim lvi As New ListViewItem(xml.SelectSingleNode("Title/LocalTitle").InnerText)
lvi.SubItems.Add(String.Join("; ", Array.ConvertAll(xml.SelectNodes("Title/Genres/Genre").Cast(Of XmlNode).ToArray, Function(n) n.InnerText)))
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 18th, 2012, 01:51 PM
#16
Thread Starter
Member
Re: ListView
 Originally Posted by .paul.
the problem is that you're saving your listview contents as excel CSV + the delimiter in a csv file is a comma.
therefore excel sees that 1 field as several. use a semi colon ; instead of a comma:
vb Code:
Dim lvi As New ListViewItem(xml.SelectSingleNode("Title/LocalTitle").InnerText)
lvi.SubItems.Add(String.Join("; ", Array.ConvertAll(xml.SelectNodes("Title/Genres/Genre").Cast(Of XmlNode).ToArray, Function(n) n.InnerText)))
Thanks. Works. Much appreciated.
-
May 18th, 2012, 02:26 PM
#17
Re: ListView
rate Paul OP and mark this thread as Resolved, please.
TY
-
May 18th, 2012, 02:41 PM
#18
Thread Starter
Member
Re: ListView
 Originally Posted by proneal
rate Paul OP and mark this thread as Resolved, please.
TY
I hope I did that right.
-
May 18th, 2012, 02:55 PM
#19
Re: ListView
Well, Sir .Paul has an absolutely brilliant future of Rep points [2000+] -wow..
I am sure you did it right, even though [RESOLVED] does not appear in Thread title.
We will overlook this minor discrepancy...
for now.
mauahhahahaha

good Luck OP!
-
May 18th, 2012, 04:30 PM
#20
Re: ListView
 Originally Posted by lag22
I hope I did that right.
you rated me. thanks
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 18th, 2012, 04:32 PM
#21
Re: ListView
 Originally Posted by proneal
Well, Sir .Paul has an absolutely brilliant future of Rep points [2000+] -wow..
I am sure you did it right, even though [RESOLVED] does not appear in Thread title.
We will overlook this minor discrepancy...
for now.
mauahhahahaha
good Luck OP!
+ counting. thanks for that. i owe you a rating next time you post a good answer...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 18th, 2012, 08:07 PM
#22
Thread Starter
Member
Re: ListView
What is the correct way to mark Resolved?
-
May 19th, 2012, 12:37 AM
#23
Re: ListView
at the top right of your original question, there's a Thread Tools menu, which contains a Mark Thread Resolved menuitem
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 19th, 2012, 09:42 AM
#24
Thread Starter
Member
Re: ListView
 Originally Posted by .paul.
at the top right of your original question, there's a Thread Tools menu, which contains a Mark Thread Resolved menuitem
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|