richtextbox.lines problem
-
Hi, First of all I think it's important to point out that my goal here is to create the image of 1 line of vertically centered text like you would find in the windows 7 calculator. My thought was to make 2 lines in the richtextbox, and on the 2nd line I would put the text. However when I do this it just doesn't show. I have checked the font color and it's black. Also multiline is true. Here is my code. Maybe I am missing something.
richTextBox1.Lines = new string[2];
richTextBox1.Lines[1] = 111;The 111 never appears in the text box and the value of richTextBox1.Lines[1] never even changes.
-
Hi, First of all I think it's important to point out that my goal here is to create the image of 1 line of vertically centered text like you would find in the windows 7 calculator. My thought was to make 2 lines in the richtextbox, and on the 2nd line I would put the text. However when I do this it just doesn't show. I have checked the font color and it's black. Also multiline is true. Here is my code. Maybe I am missing something.
richTextBox1.Lines = new string[2];
richTextBox1.Lines[1] = 111;The 111 never appears in the text box and the value of richTextBox1.Lines[1] never even changes.
Hi,
rtb2.Lines=new string\[\] { "line 1", "line 2", "line 3" };
works just fine. You should work out the difference yourself! :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
-
Hi,
rtb2.Lines=new string\[\] { "line 1", "line 2", "line 3" };
works just fine. You should work out the difference yourself! :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
I changed it to the following code and it worked so I guess I would like to know who I can set the whole array but I can't change individual items within the Lines array. I didn't see that it was read only and anyways if it was it wouldn't compile. To me it doesn't make sense.
richTextBox1.Lines = new string[2] { "", "111111" };
-
I changed it to the following code and it worked so I guess I would like to know who I can set the whole array but I can't change individual items within the Lines array. I didn't see that it was read only and anyways if it was it wouldn't compile. To me it doesn't make sense.
richTextBox1.Lines = new string[2] { "", "111111" };
After reading the documentation (you should try that, they really make an effort to explain things), I come up with:
rtb2.Lines=new string\[\] { "line 1", "line 2", "line 3" }; string\[\] lines=rtb2.Lines; lines\[1\]="new line 2"; rtb2.Lines=lines;
and that works too. BTW: I'm not saying it is the most efficient way under all circumstances... :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
-
After reading the documentation (you should try that, they really make an effort to explain things), I come up with:
rtb2.Lines=new string\[\] { "line 1", "line 2", "line 3" }; string\[\] lines=rtb2.Lines; lines\[1\]="new line 2"; rtb2.Lines=lines;
and that works too. BTW: I'm not saying it is the most efficient way under all circumstances... :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
so what is the most efficient way in your opinion?
-
Hi, First of all I think it's important to point out that my goal here is to create the image of 1 line of vertically centered text like you would find in the windows 7 calculator. My thought was to make 2 lines in the richtextbox, and on the 2nd line I would put the text. However when I do this it just doesn't show. I have checked the font color and it's black. Also multiline is true. Here is my code. Maybe I am missing something.
richTextBox1.Lines = new string[2];
richTextBox1.Lines[1] = 111;The 111 never appears in the text box and the value of richTextBox1.Lines[1] never even changes.
I wonder what the
type
of111
might be?CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
I wonder what the
type
of111
might be?CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
Console.WriteLine(111.GetType().ToString())
givesSystem.Int32
Pretty obvious, I'd say. :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).