473,586 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "ListViewSubIte m: {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.Select edListViewItemC ollection
LItems = lvModDwgs.Selec tedItems
' INFO - LItem.SubItems( 2).ToString = "ListViewSubIte m: {60-004}"
' Remove ListViewSubItem Gargage!

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

' Layout Name
' Remove the Before and After junk information
TmpStrng = LItem.SubItems( 1).ToString
TmpStrng = Microsoft.Visua lBasic.Right(Tm pStrng, Len(TmpStrng) - 18)
TmpStrng = Microsoft.Visua lBasic.Left(Tmp Strng, Len(TmpStrng) - 1)
txbDwgRename.Te xt = TmpStrng

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

Thanks in advance.

Bruce F
Nov 21 '05 #1
8 1900
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.publi c.dotnet.genera l
microsoft.publi c.dotnet.langua ges.vb
microsoft.publi c.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.c om> wrote in message
news:sg******** *************** *********@4ax.c om...
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 "ListViewSubIte m: {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.Select edListViewItemC ollection
LItems = lvModDwgs.Selec tedItems
' INFO - LItem.SubItems( 2).ToString = "ListViewSubIte m: {60-004}"
' Remove ListViewSubItem Gargage!

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

' Layout Name
' Remove the Before and After junk information
TmpStrng = LItem.SubItems( 1).ToString
TmpStrng = Microsoft.Visua lBasic.Right(Tm pStrng, Len(TmpStrng) - 18)
TmpStrng = Microsoft.Visua lBasic.Left(Tmp Strng, Len(TmpStrng) - 1)
txbDwgRename.Te xt = 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.publi c.dotnet.langua ges.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? (SelectectedTex t)

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******** ******@TK2MSFTN GP14.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.publi c.dotnet.genera l
microsoft.publi c.dotnet.langua ges.vb
microsoft.publi c.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.c om> wrote in message
news:sg******** *************** *********@4ax.c om...
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 "ListViewSubIte m: {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.Select edListViewItemC ollection
LItems = lvModDwgs.Selec tedItems
' INFO - LItem.SubItems( 2).ToString = "ListViewSubIte m: {60-004}"
' Remove ListViewSubItem Gargage!

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

' Layout Name
' Remove the Before and After junk information
TmpStrng = LItem.SubItems( 1).ToString
TmpStrng = Microsoft.Visua lBasic.Right(Tm pStrng, Len(TmpStrng) -
18)
TmpStrng = Microsoft.Visua lBasic.Left(Tmp Strng, Len(TmpStrng) - 1)
txbDwgRename.Te xt = 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.c om> wrote in message
news:sg******** *************** *********@4ax.c om...
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 "ListViewSubIte m: {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.Select edListViewItemC ollection
LItems = lvModDwgs.Selec tedItems
' INFO - LItem.SubItems( 2).ToString = "ListViewSubIte m: {60-004}"
' Remove ListViewSubItem Gargage!

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

' Layout Name
' Remove the Before and After junk information
TmpStrng = LItem.SubItems( 1).ToString
TmpStrng = Microsoft.Visua lBasic.Right(Tm pStrng, Len(TmpStrng) - 18)
TmpStrng = Microsoft.Visua lBasic.Left(Tmp Strng, Len(TmpStrng) - 1)
txbDwgRename.Te xt = 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@localhos t> 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, "Crouchie19 98" <cr**********@d iscussions.micr osoft.com>
wrote:
I really aren't fully understanding what you want to do. Are you just
wanting to select subitem(2)'s text? (SelectectedTex t)


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.c om> wrote in message
news:7n******** *************** *********@4ax.c om...
With Deft Fingers, "Stephany Young" <noone@localhos t> 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
2287
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
3366
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 void FolderList_SelectedIndexChanged(object sender, System.EventArgs e) { try
4
9701
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
3470
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! Bruce
7
14971
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 MyList data is resident in a dataset table. I'm stuck and can't choose either because. If I choose ListView as my control I don't understand how...
0
1307
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 string strHelp = C:\myfolder\ABC.HLP"; //its a hlp file Help.ShowHelp(this, strHelp,"Glossary");
12
3393
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. Very simple. I would like to create listviewitem's for display in a listview control. The listview items need to contain properties from Internet...
4
2663
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 I need to get the text AZ) and search through an array for matching text. When matching text is found I need to populate another listview with...
0
2301
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
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.