HLP: Retrieving ListView String Information

M

Mr. B

I think I'm missing something here... but is there someway to get the String
information from a ListView without the garbage that I get?

For example, I've a ListView with a couple of columns... and if I want to get
the String in a Column and I use something like LItem.SubItems(2).ToString.
This give me something like "ListViewSubItem: {60-004}" ---> where '60-004' is
the string I'm looking for. So I have to 'remove the before and after junk as
follows:

Dim TmpStrng, TmpStrng1 As String
Dim LItem As ListViewItem
Dim LItems As ListView.SelectedListViewItemCollection
LItems = lvModDwgs.SelectedItems
' INFO - LItem.SubItems(2).ToString = "ListViewSubItem: {60-004}"
' Remove ListViewSubItem Gargage!

For Each LItem In LItems
' Global Selection Item
gblSelItem = LItem.Text
lblDwgRename.Text = gblSelItem

' Layout Name
' Remove the Before and After junk information
TmpStrng = LItem.SubItems(1).ToString
TmpStrng = Microsoft.VisualBasic.Right(TmpStrng, Len(TmpStrng) - 18)
TmpStrng = Microsoft.VisualBasic.Left(TmpStrng, Len(TmpStrng) - 1)
txbDwgRename.Text = TmpStrng

Next ' LItem


So there be an easier way? True? If so... please what?

Thanks in advance.

Bruce F
 
V

Veign

Almost everybody in this newsgroup is using VB6 or lower. While you may get
a stray answer to VB.NET questions here, you should ask them in newsgroups
devoted exclusively to .NET programming. Look for newsgroups with either the
word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general
 
C

Crouchie1998

For your information this is a VB.NET newsgroup (
microsoft.public.dotnet.languages.vb
), but the user has posted the message also in a Database & ADO group too

I really aren't fully understanding what you want to do. Are you just
wanting to select subitem(2)'s text? (SelectectedText)

Crouchie1998
BA (HONS) MCP MCSE
 
S

Stephany Young

Watch your cross-posting. It can sometimes lead to foot-in-mouth disease. :)
 
S

Stephany Young

The Text property of the subitem is what you want. The use to the ToString
method is inappropriate in this case.
 
M

Mr. B

Stephany Young said:
Watch your cross-posting. It can sometimes lead to foot-in-mouth disease. :)

Well in all the 'years' I've done so (in the three that I do cross post)...
I've NEVER had someone say that it's mostly for VB6 only (of which I use to
code in)... so....

Bruce F
 
M

Mr. B

I really aren't fully understanding what you want to do. Are you just
wanting to select subitem(2)'s text? (SelectectedText)

What I want to 'get' is the TEXT only... without the excess junk stiff as:

The info I get: ListViewSubItem: {60-004}
I remove the Left stuff: ListViewSubItem: {
I remove the Right stuff: }
I end up with this: 60-004

But there must be an easier way other than removing the left/right stuff...

No biggy... just thoutht that there would be an easier way.

Regards,

Bruce F
 
S

Stephany Young

If you follow the flow of the thread that was not aimed at you, it was aimed
at the one who had a go at you.

If he had put brain into gear before letting the fingers fly then he
probably wouldn't have had a go at you at all.
 
C

Cor Ligthert

Bruce,

What I really not see from your sample is what is the starting information
in the column of your listview in that column. (Just one row as example) in
text when the listview is in detailview.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top