0

I want to scroll my textbox when he overloaded to last line. I was looking in google and I found a lot of answers, but any don't work properly. For example:

    textBox.SelectionStart = textBox.TextLength;
    textBox.ScrollToCaret();

In my IDE I don't have method ScrollToCaret(), in datasheet of my IDE it don't exist too. Is this version of previous C# language? If you have any idea please help me.

MarCovy
  • 17
  • 9
  • 1
    Note from MSDN - **This method has no effect if the control does not have focus or if the caret is already positioned in the visible region of the control.** - https://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.scrolltocaret(v=vs.110).aspx – Ashutosh Vyas May 27 '15 at 06:45
  • @ZoharPeled I am new in C#, but this is probably WPF. When I started project I chose in new project menu Visual C# -> Blank App (XAML). – MarCovy May 27 '15 at 06:53
  • @AshutoshVyas when I use code from your link I get this fragment of error Error 2 'Windows.UI.Xaml.Controls.TextBox' does not contain a definition for 'ScrollToCaret'... – MarCovy May 27 '15 at 06:56
  • Above code is for Windows Forms and not WPF – Ashutosh Vyas May 27 '15 at 11:59
  • @AshutoshVyas Ok, so how can I get autoscrolling effect in Windows Form ? – MarCovy May 27 '15 at 12:20
  • http://stackoverflow.com/questions/8938775/multiline-textbox-with-automatic-vertical-scroll – Ashutosh Vyas May 27 '15 at 12:56

0 Answers0