listview

  • Thread starter Thread starter Vmrincon
  • Start date Start date
V

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!
 
Vmrincon said:
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??
 
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
 
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
 
Back
Top