Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16030

Splitting a large string while adding it to a listview?

$
0
0
Hello, I am looking for guidance on how to Split up this large string, while also adding it to my listview.

*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST& %SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND# !THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$

I am looking to add every single 'FIRST' as the listview item, 'SECOND' as the subitem, and 'THIRD' as the last subitem.

At the moment, I am only able to add the first set into my listview.
I have a feeling I need a loop, as well as remove part of the string once it has been added to the listview, but I am quite new to VB and have tried and tried, though unsuccessful. :confused:
If you are someone who could help resolve this for me id be really greatfull for your help.

Code:

Dim stringdata as string = "*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$*@FIRST&%SECOND#!THIRD$"

Dim ida As Integer = stringdata.IndexOf("@")
Dim fda As String = stringdata.Substring(ida + 1, stringdata.IndexOf("&", id + 1) - id - 1)
Dim idb As Integer = stringdata.IndexOf("%")
Dim fdb As String = stringdata.Substring(idb + 1, stringdata.IndexOf("#", id + 1) - id - 1)
Dim idc As Integer = stringdata.IndexOf("!")
Dim fdc As String = stringdata.Substring(idc + 1, stringdata.IndexOf("$", id + 1) - id - 1)

ListView1.Items.Add(New ListViewItem({fda, fdb, fdc}))

This is all I have been able to pull from that string
Name:  123.png
Views: 41
Size:  1.3 KB
Attached Images
  

Viewing all articles
Browse latest Browse all 16030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>