Hi everyone,
I have what I think are 2 pretty simple questions. I know I have done it
before, but can't remember how I did it.

#1: I have a windows form with a textbox. The textbox is getting filled
from within a function. I need to have the scroll buttons on the text box
accessable at all times, not just when the loop that fills it gets back
around to the application.doevents line. I'm pretty sure there is an easy
way to do this with threading.

#2: This one is really dumb, but I'm having a slow day. How can I get the
text box to autoscroll to the bottom everytime & add text dynamically to it?

Thanks all in advance,

Matt

Re: 2 Simple Questions by Morten

Morten
Fri Jan 21 02:19:24 CST 2005

Hi Matthew,

On Thu, 20 Jan 2005 21:37:06 -0500, Matthew MacDonald
<mattsmac@hotmail.com> wrote:

> Hi everyone,
> I have what I think are 2 pretty simple questions. I know I have done
> it
> before, but can't remember how I did it.
>
> #1: I have a windows form with a textbox. The textbox is getting filled
> from within a function. I need to have the scroll buttons on the text
> box
> accessable at all times, not just when the loop that fills it gets back
> around to the application.doevents line. I'm pretty sure there is an
> easy
> way to do this with threading.
>

Possibly, or you could call Application.DoEvents() more often.

> #2: This one is really dumb, but I'm having a slow day. How can I get
> the
> text box to autoscroll to the bottom everytime & add text dynamically to
> it?
>

Use SelectionStart to place your caret and TextBox.ScrollToCaret() to move
the ScrollBar.

> Thanks all in advance,
>

NP

> Matt
>
>

--
Happy Coding!
Morten Wennevik [C# MVP]

Re: 2 Simple Questions by Matthew

Matthew
Fri Jan 21 06:56:47 CST 2005

The fix for #2 that you suggest works fine, thanks.

The problem with application.doevents is that I am calling it on every
iteration of my loop, but the statement in the body of the loop (a wmi call
to a remote system) takes so long to process, that it still doesn't make the
scrolling fluid, you still have to wait for the loop to get around to
process the scroll event. Any other ideas?

Thanks again,
Matt
"Morten Wennevik" <MortenWennevik@hotmail.com> wrote in message
news:opskx1emzaklbvpo@pbn_computer...
> Hi Matthew,
>
> On Thu, 20 Jan 2005 21:37:06 -0500, Matthew MacDonald
> <mattsmac@hotmail.com> wrote:
>
> > Hi everyone,
> > I have what I think are 2 pretty simple questions. I know I have done
> > it
> > before, but can't remember how I did it.
> >
> > #1: I have a windows form with a textbox. The textbox is getting
filled
> > from within a function. I need to have the scroll buttons on the text
> > box
> > accessable at all times, not just when the loop that fills it gets back
> > around to the application.doevents line. I'm pretty sure there is an
> > easy
> > way to do this with threading.
> >
>
> Possibly, or you could call Application.DoEvents() more often.
>
> > #2: This one is really dumb, but I'm having a slow day. How can I get
> > the
> > text box to autoscroll to the bottom everytime & add text dynamically to
> > it?
> >
>
> Use SelectionStart to place your caret and TextBox.ScrollToCaret() to move
> the ScrollBar.
>
> > Thanks all in advance,
> >
>
> NP
>
> > Matt
> >
> >
>
> --
> Happy Coding!
> Morten Wennevik [C# MVP]