Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

How can I autoscroll multiline textbox when I have 2many lines?

 

I tried ScrollToCaret but since there is no focus on control and text is added trough code it won�t work.

 

Another thing,

I have some demanding code on Button click handler and when I tab the form down and back up controls don't show (I know I have to redraw whole form to render stuff on it again but how?)

Should I rather use threading instead?

 

Thanks

Igor

  • *Gurus*
Posted

How are you adding text to the textbox? I think if you use AppendText, it should scroll with the text as it's added. It does in my experience anyway.

 

As for your other question, it depends on what you're doing really. It does sound as if you might have a good use for threading there. It may be simple enough to stick an Application.DoEvents() in your intensive loop. If you don't find a solution, let us know what your loop is doing and for how long, and we'll be able to advise better.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

I'm adding text - tb.text += "some text"+Enviroment.newline

(can I go to next line different?)

 

Loop is dloading allmost entire site (like 1000 pages, and parse HTML)

TBox is for status display (ie. Connected, Dloading page 1 of xxx an so on)

  • *Gurus*
Posted

Try adding text like this:

 

txtDebug.SelectionStart = txtDebug.Text.Length
txtDebug.SelectedText = strText & Environment.NewLine

 

And you'll find it scrolls to the bottom automatically as new text is added. The method you are presently using is not very efficient at all, you are resetting the whole text every time you add to it.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • 6 years later...
Posted

AppendText does not (in my case) scroll down, maybe if you got just one textbox..(?).

 

Anyway, I solved it by shifting focus:

 

this->txtOutput->Focus(); // the box who needs to be scrolled down

this->txtInput->Focus(); // the box to which initially had the focus

 

 

 

Just realized it's from 2003... But I found this thread, so hope it'll be helpfull for anyone else. (btw, registerd to post this just now :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...