autoscroll to bottom of multiline textbox being updated by backgroundworker

后端 未结 2 879
隐瞒了意图╮
隐瞒了意图╮ 2021-02-13 02:15

I have a background worker control that is set to perform a task, and update a multiline text box on my main UI using a delegate procedure. this is all working perfectly, howeve

2条回答
  •  猫巷女王i
    2021-02-13 02:25

    Try it this way:

    'textbox.Text = text
    textbox.AppendText(text)
    

    The code you commented out wasn't running on the GUI thread, and as M Granja pointed out, AppendText will automatically scroll to the appended text in the box, so no need to call ScrollToCaret.

提交回复
热议问题