0

Is there a way i can make sure my textbox scroll bar always stays at the bottom because my textbox is my messages. It looks alot better if it is at the bottom

At the start it changes my text to the text from a database so i just did this void

private void frmMain_TextChanged(object sender, EventArgs e) { textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret(); } 

but it didnt work. Is there any other ways? I also tryed putting them 2 codes in Form1_Load

1
  • Where is it currently if not on the bottom? Do you have a screenshot of it being in another place? Commented Dec 16, 2013 at 17:19

2 Answers 2

0

It looks like your code is in the wrong event. You are trying to scroll to the bottom when frmMain has it's Text change. You want to run your code when the textBox1 has its text change, not the form.

Sign up to request clarification or add additional context in comments.

Comments

0

Add your code for the Shown event for your Form so you 'would end up with code like this:

private void Form1_Shown(object sender, EventArgs e) { textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret(); } 

Kindly check that SO Question for this solution and another ways

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.