Hi,
i am adding a few lines to the multiline textBox in a Windows forms Clr application. However each and every time the vertical scrollbar goes to the bottom.
How/Can it be stopped ??

textBox1->AppendText(array[i]);

Are there any line breaks in your array?
Should there be?

I tried to replicate the problem with this (code below) and the scroll bar stayed at the top:

for each(String^ str in gcnew array<String^>{"this", "is", "neat","this", "is", "neat","this", "is", "neat","this", "is", "neat"})
{
   textBox1->AppendText(str+Environment::NewLine);
}

Do you have some other property set on the TextBox?
If you force a line-break at the very end, does it make a difference?

Hi ,
I am back. In the following replicas things are different.

// 
// textBox9
// 
 this->textBox9->BackColor = System::Drawing::Color::FloralWhite;
 this->textBox9->Font = (gcnew System::Drawing::Font(L"Arial Narrow", 12,    System::Drawing::FontStyle::Italic));
 this->textBox9->Location = System::Drawing::Point(1079, 31);
 this->textBox9->Margin = System::Windows::Forms::Padding(2);
 this->textBox9->Multiline = true;
 this->textBox9->Name = L"textBox9";
 this->textBox9->ReadOnly = true;
 this->textBox9->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
 this->textBox9->Size = System::Drawing::Size(89, 340);
 this->textBox9->TabIndex = 53;
for(int i=1;i<40;i++)
    {    
    textBox9->AppendText(Convert::ToString(i)+Environment::NewLine);          // 1
    //textBox9->AppendText(Convert::ToString(arr[i,j]=i)+Environment::NewLine); // 2
    }

Different?
Works?
Doesn't work?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.