By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

HLP: Retrieving ListView String Information

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
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
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
"Mr. B" <Us**@NoWhere.com> wrote in message
news:sg********************************@4ax.com...
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

Nov 21 '05 #2

P: n/a
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
Nov 21 '05 #3

P: n/a
Watch your cross-posting. It can sometimes lead to foot-in-mouth disease. :)
"Veign" <NO***********@veign.com> wrote in message
news:u6**************@TK2MSFTNGP14.phx.gbl...
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
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
"Mr. B" <Us**@NoWhere.com> wrote in message
news:sg********************************@4ax.com...
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


Nov 21 '05 #4

P: n/a
The Text property of the subitem is what you want. The use to the ToString
method is inappropriate in this case.
"Mr. B" <Us**@NoWhere.com> wrote in message
news:sg********************************@4ax.com...
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

Nov 21 '05 #5

P: n/a
With Deft Fingers, "Stephany Young" <noone@localhost> wrote:
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
Nov 21 '05 #6

P: n/a
With Deft Fingers, "Crouchie1998" <cr**********@discussions.microsoft.com>
wrote:
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
Nov 21 '05 #7

P: n/a
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.

"Mr. B" <Us**@NoWhere.com> wrote in message
news:7n********************************@4ax.com...
With Deft Fingers, "Stephany Young" <noone@localhost> wrote:
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

Nov 21 '05 #8

P: n/a
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
Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.