473,326 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

HLP: Retrieving ListView String Information

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
8 1888
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sagaert Johan | last post by:
Hi I have set the columreorder to true Is there a way to get/set the current columnorder, so i can restore the order from a saved setting ? Johan
2
by: Aron Henning | last post by:
I have a ListView that contains the subfoldes of a local drive. Whan i click on a subfolder the listbox should display the subfolders of this folder instead. the funktion is as follows: private...
4
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
4
by: Mr. B | last post by:
Question #1: How can you prevent a User from Stretching the Columns in a ListView? Question #2: How can you 'display' all the text of a cell when the column width is fixed? Many Thanks! ...
7
by: BobAchgill | last post by:
I am trying to decide which of these controls to use to implement letting my user select a full row from MyList. The MyList has several columns which would be nice to sort by at run time. The...
0
by: Madmax | last post by:
I am trying to use the .hlp file (an old help from for an existing app) in my application .Although the file shows up but it does not open the desired search string this is what I am doing ...
12
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. ...
4
by: spowel4 | last post by:
My form has a listview populated with the 50 states. When the user checks the checkbox within the listview for a particular state, I need to retrieve which state was checked (i.e. if AZ is checked...
0
parshupooja
by: parshupooja | last post by:
Contact Reply 1 point Member propoo Joined on 08-31-2007, 10:32 PM Posts 3 Hey all ,
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.