Using a listbox as an "Immediate" window for the user

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a listbox in value list mode as a status log for the user - much
like the Immediate window in the VB environment. Using VB code, I am posting
events in this log to provide the user with an idea of where they are in a
long rollup process. In addition, this provides both the user and me some
ability to determine if the process has run correctly. The scrolling bar on
the right allows one to look

Text strings are written to the list box using the .AddItem method.

There are two problems:
-When the program is running the box doesn't scroll to show the latest
entries. I have tried several techniques to fix this, including .Repaint and
a method I found online involving the SendMessage Windows API call, but
nothing seems to work.
-There seems to be an upper limit on the amount of data that can appear in
the list box, and I am not sure what that is - I would like to either limit
the amount of information going in or delete the older lines based on this.

Any ideas?
 
lwert said:
I am using a listbox in value list mode as a status log for the user - much
like the Immediate window in the VB environment. Using VB code, I am posting
events in this log to provide the user with an idea of where they are in a
long rollup process. In addition, this provides both the user and me some
ability to determine if the process has run correctly. The scrolling bar on
the right allows one to look

Text strings are written to the list box using the .AddItem method.

There are two problems:
-When the program is running the box doesn't scroll to show the latest
entries. I have tried several techniques to fix this, including .Repaint and
a method I found online involving the SendMessage Windows API call, but
nothing seems to work.
-There seems to be an upper limit on the amount of data that can appear in
the list box, and I am not sure what that is - I would like to either limit
the amount of information going in or delete the older lines based on this.


You can avoid all those issues if you use a text box instead
of a list box. If necessary, as long as the text box
retains the focus your code can control the scrolling by
setting the text box's SelStart property.
 
For what it's worth, I use a different approach, which you might want to
consider: I use a separate pop-up form with labels for all the stages,
and as each stage is entered into or completed (depending on how you
like it), the associated label is bolded. I also have a progress bar at
the botton that I "progress" in code at each stage, having allocated
percentages to each stage beforehand.

HTH,
Nikos
 
Back
Top