Info 1 Posted May 27, 2008 Share Posted May 27, 2008 Okay, three questions: 1. How do I make a richTextBox to read-only...? 2. I know that to insert a text to a control I need to: this.richTextBox1.Text = "new text"; But how do I make new lines? (@CRLF in AutoIt) 3. How do I insert the green lines in the progress bar? (GUICtrlSetData ($Progress, 50) in AutoIt) Thanks Link to post Share on other sites
monoceres 195 Posted May 27, 2008 Share Posted May 27, 2008 After a quick google search it turns out that System.Enviroment.NewLine is a newline in C# Broken link? PM me and I'll send you the file! Link to post Share on other sites
Richard Robertson 187 Posted May 27, 2008 Share Posted May 27, 2008 C# uses many of the same escape codes as C++. You would use the character '\n' to do a newline. '\r' is a carriage return. Link to post Share on other sites
monoceres 195 Posted May 27, 2008 Share Posted May 27, 2008 (edited) Again, I do not program in C#, but I believe this.richtextBox1.Locked=true will make the richtext readonly Edited May 27, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to post Share on other sites
Richard Robertson 187 Posted May 27, 2008 Share Posted May 27, 2008 Text controls in .Net have a property very obviously labeled as "ReadOnly". If you are using a standard .Net control, try looking for ReadOnly. Link to post Share on other sites
cppman 2 Posted May 27, 2008 Share Posted May 27, 2008 Progress bars have a property called Value. You set the Minimum and Maximum values also.So if the Minimum is 0 and the Maximum is 100, and the Value is 50, you'll have a 50% filled progress bar. Miva OS Project Link to post Share on other sites
jhunt1 0 Posted June 4, 2008 Share Posted June 4, 2008 (edited) Are you wanting to have multiple lines of text from a single string, or add a new line to text that's already in the RichTextBox? If you are wanting to have multiple lines of text from a single string, you can use the System.Enviroment.NewLine, or a simple "\n". this.richTextBox1.Text = "new\ntext"; This example puts "new" on one line, and "text" on a new line. To add new text to a RichTextBox, you can use the AppendText() method. this.richTextBox1.AppendText("new text"); Note: If using AppendText(), and you want it to be on a new line, you need to add a "\n" to the beginning of the string: this.richTextBox1.AppendText("\nnew text"); Edited June 4, 2008 by jhunt1 Link to post Share on other sites
jhunt1 0 Posted June 4, 2008 Share Posted June 4, 2008 And one more thing, to make it readonly........ this.richTextBox1.ReadOnly = true; Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now