From: James on
I have a form that lets users select a line from a listbox, change one or
more (of 5) field values, then save.
The listbox gets refreshed (cleared and repopulated). The table Always has
the new values, but the last item in the listbox row last edited,
Status(0,1,2,3), is not always displaying in the desired position, being
distanced by blank spaces.(was initially not visible until listbox widened)

If I go through a few fields(including end Status item), make changes, the
end Staus item usually displays correctly. Its as if an additional vbTab or
blank spaces are being entered. 90 other items are displayed correctly.

Listbox populated as follows:
lstTagConfig.Clear
Set rsDat = dbTag.OpenRecordset("tblTagNumber_Label")
Do Until rsDat.EOF = True
lstTagConfig.AddItem rsDat!TagNumber & Chr$(9) & rsDat!TagLabel & Chr$(9) &
rsDat!Status & Chr$(9) & rsDat!Groups & Chr$(9) & " " & rsDat!Floor &
Chr$(9) & " " & rsDat!Wing & Chr$(9) & Chr$(9) & rsDat!Status
rsDat.MoveNext
Loop
rsDat.Close

Any suggestions appreciated


From: Jeff Johnson on
"James" <nospam(a)please.com> wrote in message
news:REGjl.2915$mN5.1336(a)newsfe03.iad...

> Any suggestions appreciated

Best. Suggestion. Ever.

Use a list view instead.


From: MikeD on

"James" <nospam(a)please.com> wrote in message
news:REGjl.2915$mN5.1336(a)newsfe03.iad...
>I have a form that lets users select a line from a listbox, change one or
>more (of 5) field values, then save.
> The listbox gets refreshed (cleared and repopulated). The table Always has
> the new values, but the last item in the listbox row last edited,
> Status(0,1,2,3), is not always displaying in the desired position, being
> distanced by blank spaces.(was initially not visible until listbox
> widened)
>
> If I go through a few fields(including end Status item), make changes, the
> end Staus item usually displays correctly. Its as if an additional vbTab
> or blank spaces are being entered. 90 other items are displayed
> correctly.
>
> Listbox populated as follows:
> lstTagConfig.Clear
> Set rsDat = dbTag.OpenRecordset("tblTagNumber_Label")
> Do Until rsDat.EOF = True
> lstTagConfig.AddItem rsDat!TagNumber & Chr$(9) & rsDat!TagLabel & Chr$(9)
> & rsDat!Status & Chr$(9) & rsDat!Groups & Chr$(9) & " " & rsDat!Floor &
> Chr$(9) & " " & rsDat!Wing & Chr$(9) & Chr$(9) & rsDat!Status
> rsDat.MoveNext
> Loop
> rsDat.Close
>
> Any suggestions appreciated

My suggestion is don't use a ListBox for this. As best as I can tell,
you're using the tab character to create multiple "columns". A ListBox is
not really well-suited for this. Use a grid control or the ListView control
instead, both of which can have "real" columns.

And to make your code more readable, in the future, use the constant vbTab
instead of Chr$(9).

And just to make sure, you ARE using VB6 and ARE using its own listbox
(rather than some 3rd party listbox or the one from Fm20.dll), right?

Another recommendation I have is to not use the bang operator (that's the
!). It looks like you're using DAO, so instead, you'd have this:
rsdat.Fields("TagNumber").Value

Oh, and something else...indent your code appropriately (the 2 statements in
between the Do and the Loop should be indented). This is also to make your
code easier to read.

I know you didn't ask for a critique, but I couldn't help it.

--
Mike

From: Karl E. Peterson on
James wrote:
> Any suggestions appreciated

[VBnet Utilities] VBnet CoolTabs Visual Tabstop Designer
http://vbnet.mvps.org/code/listapi/cooltabs.htm
--
..NET: It's About Trust!
http://vfred.mvps.org