Home All Groups Group Topic Archive Search About
Author
19 Oct 2006 10:51 AM
Vmrincon
Hi everybody:

  Something weird is happening to me:

   I have a listview that I would like to sort in a special way.
Because of that I have two different functions that sort it. I run the
following code:

    Sort1(listv)
    Sort(listv)
    Me.ShowDialog()

   The funny thing is that after this, the ShowDialog only shows the
listview affected by the second function, it looks like it skipped the
first one!!!

   But if instead we run this code


    Sort11(listv)
    Me.ShowDialog()
    Sort2(listv)
    Me.ShowDialog()


   After the second call to ShowDialog, the result is perfect and the
items are sorted as the desired way. I feel it must happen some event
or something inside the ShowDialog that updates the listview and I am
missing it in the first code. What that could be? I will be thankful if
anyone could give me some advice.

  Thanks a lot!

Author
19 Oct 2006 11:52 AM
Norman Chong
Vmrincon schrieb:

>     Sort11(listv)
>     Me.ShowDialog()
>     Sort2(listv)
>     Me.ShowDialog()

It might be helpful if you post the code of your Sort-functions and
where you call them.

> After the second call to ShowDialog, the result is perfect and the
> items are sorted as the desired way. I feel it must happen some event
> or something inside the ShowDialog that updates the listview and I am
> missing it in the first code. What that could be? I will be thankful if
> anyone could give me some advice.

Do you call Listview1.update() in both of your sort-functions??
Author
19 Oct 2006 3:41 PM
Steve Long
Actually, you might want to look up:
Listview.Sort in the documentation. You can write your own custom sorter,
however you see fit just by implementing the IComparer interface.

Steve

Show quoteHide quote
"Vmrincon" <vmrin***@gmail.com> wrote in message
news:1161255102.868822.157640@m7g2000cwm.googlegroups.com...
> Hi everybody:
>
>  Something weird is happening to me:
>
>   I have a listview that I would like to sort in a special way.
> Because of that I have two different functions that sort it. I run the
> following code:
>
>    Sort1(listv)
>    Sort(listv)
>    Me.ShowDialog()
>
>   The funny thing is that after this, the ShowDialog only shows the
> listview affected by the second function, it looks like it skipped the
> first one!!!
>
>   But if instead we run this code
>
>
>    Sort11(listv)
>    Me.ShowDialog()
>    Sort2(listv)
>    Me.ShowDialog()
>
>
>   After the second call to ShowDialog, the result is perfect and the
> items are sorted as the desired way. I feel it must happen some event
> or something inside the ShowDialog that updates the listview and I am
> missing it in the first code. What that could be? I will be thankful if
> anyone could give me some advice.
>
>  Thanks a lot!
>
Author
20 Oct 2006 5:24 AM
Vmrincon
Well thanks to both of you, but I already fixed the problem running
just on of the sorting methods with a more complicated logic.

Greetings, Victor


Steve Long wrote:
Show quoteHide quote
> Actually, you might want to look up:
> Listview.Sort in the documentation. You can write your own custom sorter,
> however you see fit just by implementing the IComparer interface.
>
> Steve
>
> "Vmrincon" <vmrin***@gmail.com> wrote in message
> news:1161255102.868822.157640@m7g2000cwm.googlegroups.com...
> > Hi everybody:
> >
> >  Something weird is happening to me:
> >
> >   I have a listview that I would like to sort in a special way.
> > Because of that I have two different functions that sort it. I run the
> > following code:
> >
> >    Sort1(listv)
> >    Sort(listv)
> >    Me.ShowDialog()
> >
> >   The funny thing is that after this, the ShowDialog only shows the
> > listview affected by the second function, it looks like it skipped the
> > first one!!!
> >
> >   But if instead we run this code
> >
> >
> >    Sort11(listv)
> >    Me.ShowDialog()
> >    Sort2(listv)
> >    Me.ShowDialog()
> >
> >
> >   After the second call to ShowDialog, the result is perfect and the
> > items are sorted as the desired way. I feel it must happen some event
> > or something inside the ShowDialog that updates the listview and I am
> > missing it in the first code. What that could be? I will be thankful if
> > anyone could give me some advice.
> >
> >  Thanks a lot!
> >