|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HLP: Retrieving ListView String Informationinformation 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 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" <U***@NoWhere.com> wrote in message LItem.SubItems(2).ToString.news:sg0451plbfmn3f3d707fseu470tfounocj@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 > This give me something like "ListViewSubItem: {60-004}" ---> where '60-004' isShow quoteHide quote > 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 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 With Deft Fingers, "Crouchie1998" <crouchie1***@discussions.microsoft.com> What I want to 'get' is the TEXT only... without the excess junk stiff as:wrote: >I really aren't fully understanding what you want to do. Are you just >wanting to select subitem(2)'s text? (SelectectedText) 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 Watch your cross-posting. It can sometimes lead to foot-in-mouth disease. :)
Show quoteHide quote "Veign" <NOSPAMinveign@veign.com> wrote in message news:u6J$X9YOFHA.3076@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" <U***@NoWhere.com> wrote in message > news:sg0451plbfmn3f3d707fseu470tfounocj@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 > > With Deft Fingers, "Stephany Young" <noone@localhost> wrote: Well in all the 'years' I've done so (in the three that I do cross post)...>Watch your cross-posting. It can sometimes lead to foot-in-mouth disease. :) I've NEVER had someone say that it's mostly for VB6 only (of which I use to code in)... so.... Bruce F 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. Show quoteHide quote "Mr. B" <U***@NoWhere.com> wrote in message news:7n8451dve7naeueu5o0oes3ak1i63ej0qa@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 The Text property of the subitem is what you want. The use to the ToString
method is inappropriate in this case. Show quoteHide quote "Mr. B" <U***@NoWhere.com> wrote in message news:sg0451plbfmn3f3d707fseu470tfounocj@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 See the attached project (zipped)
or: Column 1: MessageBox.Show(ListView1.SelectedItems(0).Text) Column 2: MessageBox.Show(ListView1.SelectedItem.(0).SubItems(1).Text) Column 3 MessageBox.Show(ListView1.SelectedItems(0).SubItems(2).Text & " sec(s)) I hope this helps Crouchie1998 BA (HONS) MCP MCSE [attached file: ListView Example.zip] 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
?syntax to recognize code in a 2nd file
Scripting Runtime ARRAYLIST ADDING A CLASS Question on updating data sockets O.T.:Shameless Plug to get Free Software(for me & for you too) How to provide hint on sub params? Transpose datagrid row to corresponding label text How to check for scroll bars in web browser object? Inherited User Control + Subclassed components + Dissapear after build!!!!!!!!!!!!!!! |
|||||||||||||||||||||||