I'm using vb.net and I'm sorting several listview rows by the 1st column date
using a comparator sort routine. I'm sending this sorted info to a word
document. The listview sort results are correct but when I use a loop to
generate the item index(as below), the original unsorted order is sent to the
word document.
For zRow As Integer = 0 To LV1.Items.Count - 1
With oTable
' Insert the data into the specific cell.
.Cell(zRow, 1).Range.InsertAfter(LV1.Items(zRow).Text)
.Cell(zRow, 2).Range.InsertAfter(LV1.Items(zRow).SubItems(1).Text)
.Cell(zRow, 3).Range.InsertAfter(LV1.Items(zRow).SubItems(2).Text)
.Cell(zRow, 4).Range.InsertAfter(LV1.Items(zRow).SubItems(3).Text)
End With
Next zRow
But it gets better....
If I move the above code to a button_click procedure, it sends the correct
sorted order to the word document???
As you can tell I'm a VB6 user and a novice at that.
Thanks for any help,
Bob
Jeff Johnson - 28 Nov 2008 21:19 GMT
> I'm using vb.net
[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB
2005/2008 and VB Express, which have dropped .NET from their names) are
off-topic here.
Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.
For questions specific to the VB.NET language, use this group:
microsoft.public.dotnet.languages.vb
Please note that things like controls and data access, which have their own
subgroups in the Classic VB hierarchy, are not language-specific in .NET, so
you should look for groups like these:
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
Bill McCarthy - 28 Nov 2008 23:45 GMT
Hi Bob,
For .Net questions best to ask in the dotnet forums :
microsoft.public.dotnet.languages.vb
As to your question, you haven't said how you are triggering the writing to
the word doc in the first example (when it isn't sorted), but it sounds like
it is similar to a binding not being propagated until the control looses
focus.
> I'm using vb.net and I'm sorting several listview rows by the 1st column
> date
[quoted text clipped - 30 lines]
> Thanks for any help,
> Bob