|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ListView SortKeyVB6 has a SorkKey property that you can setup on the ListView control to
tell the ListView what column to use for sorting. In .NET there is a Sort() method and a SortOrder property that you can use to manipulate the Sorting property. My question is how do I perform the same functionality as I do in VB6 setting the SortKey and SortOrder with the ListView. Dave Use the ListViewItemSorter
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindowsformslistviewclasslistviewitemsortertopic.htm Private Sub ColumnClick(ByVal o As Object, ByVal e As ColumnClickEventArgs) ' Set the ListViewItemSorter property to a new ListViewItemComparer object. Me.listView1.ListViewItemSorter = New ListViewItemComparer(e.Column) ' Call the sort method to manually sort the column based on the ListViewItemComparer implementation. listView1.Sort() End Sub ' Implements the manual sorting of items by columns. Class ListViewItemComparer Implements IComparer Private col As Integer Public Sub New() col = 0 End Sub Public Sub New(ByVal column As Integer) col = column End Sub Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer _ Implements IComparer.Compare Return [String].Compare(CType(x, ListViewItem).SubItems(col).Text, CType(y, ListViewItem).SubItems(col).Text) End Function End Class Show quoteHide quote "Dave" <KingOfTheBeach@community.nospam> wrote in message news:uxbRmXsGGHA.4036@TK2MSFTNGP12.phx.gbl... > > VB6 has a SorkKey property that you can setup on the ListView control to > tell the ListView what column to use for sorting. In .NET there is a > Sort() > method and a SortOrder property that you can use to manipulate the Sorting > property. My question is how do I perform the same functionality as I do > in VB6 setting the SortKey and SortOrder with the ListView. > > Dave > > This implements manual sorting. Is there such thing as automatic where you
just specify the column and the sort order ? "AMDRIT" <amd***@hotmail.com> wrote in message ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindowsnews:uWJIzdsGGHA.1032@TK2MSFTNGP15.phx.gbl... > > Use the ListViewItemSorter > > formslistviewclasslistviewitemsortertopic.htm Show quoteHide quote > ListViewItem).SubItems(col).Text,> > > Private Sub ColumnClick(ByVal o As Object, ByVal e As ColumnClickEventArgs) > ' Set the ListViewItemSorter property to a new ListViewItemComparer > object. > Me.listView1.ListViewItemSorter = New ListViewItemComparer(e.Column) > ' Call the sort method to manually sort the column based on the > ListViewItemComparer implementation. > listView1.Sort() > End Sub > > ' Implements the manual sorting of items by columns. > Class ListViewItemComparer > Implements IComparer > > Private col As Integer > > Public Sub New() > col = 0 > End Sub > > Public Sub New(ByVal column As Integer) > col = column > End Sub > > Public Function Compare(ByVal x As Object, ByVal y As Object) As > Integer _ > Implements IComparer.Compare > Return [String].Compare(CType(x, Show quoteHide quote > CType(y, ListViewItem).SubItems(col).Text) > End Function > End Class > > > > "Dave" <KingOfTheBeach@community.nospam> wrote in message > news:uxbRmXsGGHA.4036@TK2MSFTNGP12.phx.gbl... > > > > VB6 has a SorkKey property that you can setup on the ListView control to > > tell the ListView what column to use for sorting. In .NET there is a > > Sort() > > method and a SortOrder property that you can use to manipulate the Sorting > > property. My question is how do I perform the same functionality as I do > > in VB6 setting the SortKey and SortOrder with the ListView. > > > > Dave > > > > > > It doesn't appear so. Perhaps, you can create your own control that derives
from the listview that will implement this technology and then it will be "automatic" public class MyListViewItem inherits ListViewItem public property CompareType as Type end Property end Class Public class MyListView inherits ListView event OnColumnClicked(object, MyColumnClickEventArgs) Public Shadows Property Item(index as integer) as MyListViewItem End Property private sub ColumnClicked(object, ColumnClickEventArgs) dim MyColumnClickEventArgs as ColumnClickEventArgs raiseevent oncolumnclicked(me, temparg) if not temparg.handled then 'perform customsort end if end sub end Class Show quoteHide quote "Dave" <KingOfTheBeach@community.nospam> wrote in message news:OPNGjAtGGHA.4036@TK2MSFTNGP12.phx.gbl... > This implements manual sorting. Is there such thing as automatic where > you > just specify the column and the sort order ? > > > "AMDRIT" <amd***@hotmail.com> wrote in message > news:uWJIzdsGGHA.1032@TK2MSFTNGP15.phx.gbl... >> >> Use the ListViewItemSorter >> >> > ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindows > formslistviewclasslistviewitemsortertopic.htm >> >> >> >> Private Sub ColumnClick(ByVal o As Object, ByVal e As > ColumnClickEventArgs) >> ' Set the ListViewItemSorter property to a new ListViewItemComparer >> object. >> Me.listView1.ListViewItemSorter = New ListViewItemComparer(e.Column) >> ' Call the sort method to manually sort the column based on the >> ListViewItemComparer implementation. >> listView1.Sort() >> End Sub >> >> ' Implements the manual sorting of items by columns. >> Class ListViewItemComparer >> Implements IComparer >> >> Private col As Integer >> >> Public Sub New() >> col = 0 >> End Sub >> >> Public Sub New(ByVal column As Integer) >> col = column >> End Sub >> >> Public Function Compare(ByVal x As Object, ByVal y As Object) As >> Integer _ >> Implements IComparer.Compare >> Return [String].Compare(CType(x, > ListViewItem).SubItems(col).Text, >> CType(y, ListViewItem).SubItems(col).Text) >> End Function >> End Class >> >> >> >> "Dave" <KingOfTheBeach@community.nospam> wrote in message >> news:uxbRmXsGGHA.4036@TK2MSFTNGP12.phx.gbl... >> > >> > VB6 has a SorkKey property that you can setup on the ListView control >> > to >> > tell the ListView what column to use for sorting. In .NET there is a >> > Sort() >> > method and a SortOrder property that you can use to manipulate the > Sorting >> > property. My question is how do I perform the same functionality as I > do >> > in VB6 setting the SortKey and SortOrder with the ListView. >> > >> > Dave >> > >> > >> >> > > VB6 to VB.NET - not impossible, but nearly :(
should prolly throw it all away start over and do it in C# don't want to be the one to tell management that their millions of dollars in software investment is a throw away though Show quoteHide quote "AMDRIT" <amd***@hotmail.com> wrote in message ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindowsnews:eBnNQUtGGHA.596@TK2MSFTNGP10.phx.gbl... > It doesn't appear so. Perhaps, you can create your own control that derives > from the listview that will implement this technology and then it will be > "automatic" > > public class MyListViewItem > inherits ListViewItem > public property CompareType as Type > end Property > end Class > > Public class MyListView > inherits ListView > > event OnColumnClicked(object, MyColumnClickEventArgs) > > Public Shadows Property Item(index as integer) as MyListViewItem > End Property > > private sub ColumnClicked(object, ColumnClickEventArgs) > dim MyColumnClickEventArgs as ColumnClickEventArgs > raiseevent oncolumnclicked(me, temparg) > if not temparg.handled then > 'perform customsort > end if > end sub > > end Class > > "Dave" <KingOfTheBeach@community.nospam> wrote in message > news:OPNGjAtGGHA.4036@TK2MSFTNGP12.phx.gbl... > > This implements manual sorting. Is there such thing as automatic where > > you > > just specify the column and the sort order ? > > > > > > "AMDRIT" <amd***@hotmail.com> wrote in message > > news:uWJIzdsGGHA.1032@TK2MSFTNGP15.phx.gbl... > >> > >> Use the ListViewItemSorter > >> > >> > > Show quoteHide quote > > formslistviewclasslistviewitemsortertopic.htm > >> > >> > >> > >> Private Sub ColumnClick(ByVal o As Object, ByVal e As > > ColumnClickEventArgs) > >> ' Set the ListViewItemSorter property to a new ListViewItemComparer > >> object. > >> Me.listView1.ListViewItemSorter = New ListViewItemComparer(e.Column) > >> ' Call the sort method to manually sort the column based on the > >> ListViewItemComparer implementation. > >> listView1.Sort() > >> End Sub > >> > >> ' Implements the manual sorting of items by columns. > >> Class ListViewItemComparer > >> Implements IComparer > >> > >> Private col As Integer > >> > >> Public Sub New() > >> col = 0 > >> End Sub > >> > >> Public Sub New(ByVal column As Integer) > >> col = column > >> End Sub > >> > >> Public Function Compare(ByVal x As Object, ByVal y As Object) As > >> Integer _ > >> Implements IComparer.Compare > >> Return [String].Compare(CType(x, > > ListViewItem).SubItems(col).Text, > >> CType(y, ListViewItem).SubItems(col).Text) > >> End Function > >> End Class > >> > >> > >> > >> "Dave" <KingOfTheBeach@community.nospam> wrote in message > >> news:uxbRmXsGGHA.4036@TK2MSFTNGP12.phx.gbl... > >> > > >> > VB6 has a SorkKey property that you can setup on the ListView control > >> > to > >> > tell the ListView what column to use for sorting. In .NET there is a > >> > Sort() > >> > method and a SortOrder property that you can use to manipulate the > > Sorting > >> > property. My question is how do I perform the same functionality as I > > do > >> > in VB6 setting the SortKey and SortOrder with the ListView. > >> > > >> > Dave > >> > > >> > > >> > >> > > > > > > I feel your pain.
however, You can continue to use the common controls in .Net and it will work just fine. You can use the new common controls and implement your desired enhancements as you wish. You can continue to use the VB 6 interface and start reworking the backend in .Net. There are trade off's when dealing with the next generation of VB, and that should have been considered by the business or other decision makers prior to deciding to move to .Net. Simply throwing it all away just to spit VB and moving to C# doesn't change the fact that there is now a different way to do the same things. Albeit, in some cases, it seems more cumbersome. You do gain the fact that now, VB sits squarely in the same arena that C++ does. Granted the two may have different applications, they are now more closely considered equals than ever before. Have you seen what Microsoft has done to VB in .Net 2005? The certainly demonstrated that VB was very much a viable solution in the software development arena. Moving to VB.Net is more than an enhancement in feature set, it is an opening to options that we didn't have (yes, even with all the api at our disposal.) Anyone assuming that a direct port from VB 6, to VB.Net of any production application is sorely misguided. This is old news, we have known that there were significant changes as early as 2001, back when we had 6 years until VB of the old died. The brightest side of this is that you have the lessons learned of a legacy system. You have a code base to defer to. You do not have to rely so much on "Subject Matter Experts" or "Business Users". All of your critical decision trees are completed. You still have a year before VB of the old goes under. It seems to me that your legacy system is working in production and, barring the advent of the latest computer plague, will continue to function when left unmarred for some time yet. You are not completely pinned to a wall, even this late in the game. You may find yourself creating a more disparate system until the conversion process is complete. Don't be afraid of that change, embrace the fact that you are no longer solely supporting an existing system and that you now have the ability "If I had it to do all it all over again". Knowing that you might have to come out of your comfort zone, should be exhilarating to you as a developer. VB hasn't let us down, it merely graduated from high school. I apologize for the diatribe, I just get frustrated with all the doomsday talk when, yet another VB programmer first treads into the vast possibilities of the next generation. Sheesh, on release day of 2005, people were already bashing Microsoft ("The necessary evil, that it is") for one reason or another. One size does not fit all, make of it as you will or make your own. Show quoteHide quote "Dave" <KingOfTheBeach@community.nospam> wrote in message news:eZ0nhQ4GGHA.2320@TK2MSFTNGP11.phx.gbl... > VB6 to VB.NET - not impossible, but nearly :( > > should prolly throw it all away start over and do it in C# > > don't want to be the one to tell management that their millions of dollars > in software investment is a throw away though > > > "AMDRIT" <amd***@hotmail.com> wrote in message > news:eBnNQUtGGHA.596@TK2MSFTNGP10.phx.gbl... >> It doesn't appear so. Perhaps, you can create your own control that > derives >> from the listview that will implement this technology and then it will be >> "automatic" >> >> public class MyListViewItem >> inherits ListViewItem >> public property CompareType as Type >> end Property >> end Class >> >> Public class MyListView >> inherits ListView >> >> event OnColumnClicked(object, MyColumnClickEventArgs) >> >> Public Shadows Property Item(index as integer) as MyListViewItem >> End Property >> >> private sub ColumnClicked(object, ColumnClickEventArgs) >> dim MyColumnClickEventArgs as ColumnClickEventArgs >> raiseevent oncolumnclicked(me, temparg) >> if not temparg.handled then >> 'perform customsort >> end if >> end sub >> >> end Class >> >> "Dave" <KingOfTheBeach@community.nospam> wrote in message >> news:OPNGjAtGGHA.4036@TK2MSFTNGP12.phx.gbl... >> > This implements manual sorting. Is there such thing as automatic where >> > you >> > just specify the column and the sort order ? >> > >> > >> > "AMDRIT" <amd***@hotmail.com> wrote in message >> > news:uWJIzdsGGHA.1032@TK2MSFTNGP15.phx.gbl... >> >> >> >> Use the ListViewItemSorter >> >> >> >> >> > > ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindows >> > formslistviewclasslistviewitemsortertopic.htm >> >> >> >> >> >> >> >> Private Sub ColumnClick(ByVal o As Object, ByVal e As >> > ColumnClickEventArgs) >> >> ' Set the ListViewItemSorter property to a new ListViewItemComparer >> >> object. >> >> Me.listView1.ListViewItemSorter = New ListViewItemComparer(e.Column) >> >> ' Call the sort method to manually sort the column based on the >> >> ListViewItemComparer implementation. >> >> listView1.Sort() >> >> End Sub >> >> >> >> ' Implements the manual sorting of items by columns. >> >> Class ListViewItemComparer >> >> Implements IComparer >> >> >> >> Private col As Integer >> >> >> >> Public Sub New() >> >> col = 0 >> >> End Sub >> >> >> >> Public Sub New(ByVal column As Integer) >> >> col = column >> >> End Sub >> >> >> >> Public Function Compare(ByVal x As Object, ByVal y As Object) As >> >> Integer _ >> >> Implements IComparer.Compare >> >> Return [String].Compare(CType(x, >> > ListViewItem).SubItems(col).Text, >> >> CType(y, ListViewItem).SubItems(col).Text) >> >> End Function >> >> End Class >> >> >> >> >> >> >> >> "Dave" <KingOfTheBeach@community.nospam> wrote in message >> >> news:uxbRmXsGGHA.4036@TK2MSFTNGP12.phx.gbl... >> >> > >> >> > VB6 has a SorkKey property that you can setup on the ListView >> >> > control >> >> > to >> >> > tell the ListView what column to use for sorting. In .NET there is >> >> > a >> >> > Sort() >> >> > method and a SortOrder property that you can use to manipulate the >> > Sorting >> >> > property. My question is how do I perform the same functionality >> >> > as > I >> > do >> >> > in VB6 setting the SortKey and SortOrder with the ListView. >> >> > >> >> > Dave >> >> > >> >> > >> >> >> >> >> > >> > >> >> > > I'm at least working with a couple of applications that were pretty well
structured before they were upgraded, so I got a decent upgrade. It's just some of the features that have been discarded frustrate many of the issues. So I vented a bit. Thanks for the diatribe and the time spent writing it. I'm not completely frustrated because of my years of experience writing windows software dating back to the original windows 3.0, I've been able to solve most of my problems myself. I just get surprised sometimes when it requires more implementation to solve a problem that VB6 solved in a line or two of property settings. Show quoteHide quote "AMDRIT" <amd***@hotmail.com> wrote in message ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindowsnews:OpiiXp4GGHA.312@TK2MSFTNGP09.phx.gbl... > I feel your pain. > > however, > > You can continue to use the common controls in .Net and it will work just > fine. You can use the new common controls and implement your desired > enhancements as you wish. You can continue to use the VB 6 interface and > start reworking the backend in .Net. > > There are trade off's when dealing with the next generation of VB, and that > should have been considered by the business or other decision makers prior > to deciding to move to .Net. Simply throwing it all away just to spit VB > and moving to C# doesn't change the fact that there is now a different way > to do the same things. Albeit, in some cases, it seems more cumbersome. > You do gain the fact that now, VB sits squarely in the same arena that C++ > does. Granted the two may have different applications, they are now more > closely considered equals than ever before. > > Have you seen what Microsoft has done to VB in .Net 2005? The certainly > demonstrated that VB was very much a viable solution in the software > development arena. Moving to VB.Net is more than an enhancement in feature > set, it is an opening to options that we didn't have (yes, even with all the > api at our disposal.) > > Anyone assuming that a direct port from VB 6, to VB.Net of any production > application is sorely misguided. This is old news, we have known that there > were significant changes as early as 2001, back when we had 6 years until VB > of the old died. > > The brightest side of this is that you have the lessons learned of a legacy > system. You have a code base to defer to. You do not have to rely so much > on "Subject Matter Experts" or "Business Users". All of your critical > decision trees are completed. > > You still have a year before VB of the old goes under. It seems to me that > your legacy system is working in production and, barring the advent of the > latest computer plague, will continue to function when left unmarred for > some time yet. You are not completely pinned to a wall, even this late in > the game. > > You may find yourself creating a more disparate system until the conversion > process is complete. Don't be afraid of that change, embrace the fact that > you are no longer solely supporting an existing system and that you now have > the ability "If I had it to do all it all over again". Knowing that you > might have to come out of your comfort zone, should be exhilarating to you > as a developer. > > VB hasn't let us down, it merely graduated from high school. > > I apologize for the diatribe, I just get frustrated with all the doomsday > talk when, yet another VB programmer first treads into the vast > possibilities of the next generation. Sheesh, on release day of 2005, > people were already bashing Microsoft ("The necessary evil, that it is") for > one reason or another. One size does not fit all, make of it as you will or > make your own. > > > "Dave" <KingOfTheBeach@community.nospam> wrote in message > news:eZ0nhQ4GGHA.2320@TK2MSFTNGP11.phx.gbl... > > VB6 to VB.NET - not impossible, but nearly :( > > > > should prolly throw it all away start over and do it in C# > > > > don't want to be the one to tell management that their millions of dollars > > in software investment is a throw away though > > > > > > "AMDRIT" <amd***@hotmail.com> wrote in message > > news:eBnNQUtGGHA.596@TK2MSFTNGP10.phx.gbl... > >> It doesn't appear so. Perhaps, you can create your own control that > > derives > >> from the listview that will implement this technology and then it will be > >> "automatic" > >> > >> public class MyListViewItem > >> inherits ListViewItem > >> public property CompareType as Type > >> end Property > >> end Class > >> > >> Public class MyListView > >> inherits ListView > >> > >> event OnColumnClicked(object, MyColumnClickEventArgs) > >> > >> Public Shadows Property Item(index as integer) as MyListViewItem > >> End Property > >> > >> private sub ColumnClicked(object, ColumnClickEventArgs) > >> dim MyColumnClickEventArgs as ColumnClickEventArgs > >> raiseevent oncolumnclicked(me, temparg) > >> if not temparg.handled then > >> 'perform customsort > >> end if > >> end sub > >> > >> end Class > >> > >> "Dave" <KingOfTheBeach@community.nospam> wrote in message > >> news:OPNGjAtGGHA.4036@TK2MSFTNGP12.phx.gbl... > >> > This implements manual sorting. Is there such thing as automatic where > >> > you > >> > just specify the column and the sort order ? > >> > > >> > > >> > "AMDRIT" <amd***@hotmail.com> wrote in message > >> > news:uWJIzdsGGHA.1032@TK2MSFTNGP15.phx.gbl... > >> >> > >> >> Use the ListViewItemSorter > >> >> > >> >> > >> > > > > >> > formslistviewclasslistviewitemsortertopic.htm ListViewItemComparer(e.Column)> >> >> > >> >> > >> >> > >> >> Private Sub ColumnClick(ByVal o As Object, ByVal e As > >> > ColumnClickEventArgs) > >> >> ' Set the ListViewItemSorter property to a new ListViewItemComparer > >> >> object. > >> >> Me.listView1.ListViewItemSorter = New Show quoteHide quote > >> >> ' Call the sort method to manually sort the column based on the > >> >> ListViewItemComparer implementation. > >> >> listView1.Sort() > >> >> End Sub > >> >> > >> >> ' Implements the manual sorting of items by columns. > >> >> Class ListViewItemComparer > >> >> Implements IComparer > >> >> > >> >> Private col As Integer > >> >> > >> >> Public Sub New() > >> >> col = 0 > >> >> End Sub > >> >> > >> >> Public Sub New(ByVal column As Integer) > >> >> col = column > >> >> End Sub > >> >> > >> >> Public Function Compare(ByVal x As Object, ByVal y As Object) As > >> >> Integer _ > >> >> Implements IComparer.Compare > >> >> Return [String].Compare(CType(x, > >> > ListViewItem).SubItems(col).Text, > >> >> CType(y, ListViewItem).SubItems(col).Text) > >> >> End Function > >> >> End Class > >> >> > >> >> > >> >> > >> >> "Dave" <KingOfTheBeach@community.nospam> wrote in message > >> >> news:uxbRmXsGGHA.4036@TK2MSFTNGP12.phx.gbl... > >> >> > > >> >> > VB6 has a SorkKey property that you can setup on the ListView > >> >> > control > >> >> > to > >> >> > tell the ListView what column to use for sorting. In .NET there is > >> >> > a > >> >> > Sort() > >> >> > method and a SortOrder property that you can use to manipulate the > >> > Sorting > >> >> > property. My question is how do I perform the same functionality > >> >> > as > > I > >> > do > >> >> > in VB6 setting the SortKey and SortOrder with the ListView. > >> >> > > >> >> > Dave > >> >> > > >> >> > > >> >> > >> >> > >> > > >> > > >> > >> > > > > > >
Dynamic variable/object name reference. how to do in VB.NET?
Guidance on remoting Image dimensions? How to convert a selectedIndex to SelectedValue for ComboBox Multiple Catches in Try/Catch ms.public.dotnet.vb.general - an "ex group" Append to XML? Enter key vs Return key Comm Ports Question on VB.Net security for the application to run on network drive |
|||||||||||||||||||||||