strings(seperation)

  • Thread starter Thread starter juli
  • Start date Start date
J

juli

Hello!
I made a class(form) which is suppose to represent a message box.
I am sending to it constractor a string exc_str which is :

string[] exc_string = (string[])al.ToArray(typeof(string));
string exc_str=String.Join("\n",exc_string);

than I am trying to present this string in a text box but it presents
all the string together,not seperating it with "\n" although if I send
this string as a source to regular MessageBox - it is.

How can I do it in mine MsgBox which contains a text box to present
this string?
 
I beleive it is due to the newline you are using.
Try:
string exc_str=String.Join("\r\n",exc_string);
\r\n is the Windows character sequence that signals a new line.
 
Thanks but it didn't help. Maybe there is some other way to do it in
text box(bacause in MessageBox it works and in text box it isn't)?
 
or you can use "Environment.Newline". And be sure to set the textbox's
multiline property to true to see it properly.

Ab.
http://joehacker.blogspot.com


Dennis Myrén said:
I beleive it is due to the newline you are using.
Try:
string exc_str=String.Join("\r\n",exc_string);
\r\n is the Windows character sequence that signals a new line.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
juli said:
Hello!
I made a class(form) which is suppose to represent a message box.
I am sending to it constractor a string exc_str which is :

string[] exc_string = (string[])al.ToArray(typeof(string));
string exc_str=String.Join("\n",exc_string);

than I am trying to present this string in a text box but it presents
all the string together,not seperating it with "\n" although if I send
this string as a source to regular MessageBox - it is.

How can I do it in mine MsgBox which contains a text box to present
this string?
 
Hi,

I propose to use "Environment.NewLine" instead of "\r\n".

Marcin
 
Thanks ,the multiline properie helped.

I also want the size of the text box be adaptive to the size of the text
inside(it breakes the line if text too long instead of increase its
size)?

Another question,how can I make the both scrolls visible in text box? (I
changed the scrollbars propertie of text box to both but I don't see
them)
Thanks a lot!
 
If you set the WordWrap to False, the text will not wrap and you'll see the
horizontal scroll bars.
I also want the size of the text box be adaptive to the size of the text
inside(it breakes the line if text too long instead of increase its
size)?

increasing the size is not a good idea, but you'll see the scrol bars
instead.

Ab.
 
Back
Top