? :( Loading into & Saving Text File from RichTextBox ): ?

For the project of compiler, i already have the rows & cols sloutons from these forums, thanks every one for that specally dman1

now for the phase of Lexical Analysis, i have to generate tokens, i m using vb.net, i have made a listbox that holds all possible KEYWORDS alowed in the grammer, i match every seperate WORD with all itmes of that list

now the problem is all KEYWORDS found should be displayed & saved in a text file, i want to know how can we save the text in the richtextbox control in a text file, & how can we load it back?

see simply loading text file into & Saving Text File from RichTextBox


Also if someone can tell if we want to check the character we are reading from the rich text box, we write

if rtb1.text.chars(index) = "A"

if rtb1.text.chars(index) = "@"

if rtb1.text.chars(index) = " " 'to check if thats space

then how can we check if that position character is a new line or return key character / symbol?


Also tell please when we write

if rtb1.text.chars(index).isSeperator

what character are detected in IsSeperator, in isWhitreSpace (does the newline / return key symbol is detected in this), in isSurrogate (what is this?)

[1353 byte] By [maqk] at [2007-12-22]
# 1
For the first question, to save RTB's data into a file :My.Computer.FileSystem.WriteAllText("C:\Test.rtf", RichTextBox1.Text, True)And to load it (or read) :RichTextBox1.Text = My.Computer.FileSystem.ReadAllText("C:\Test.rtf")

For the second question, use Chr(10), for example :If RichTextBox1.Text.Chars(0) = Chr(10) Then MessageBox.Show("Okay :)")
MoayadMardini at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 2

tks Moayad Mardini,

chr(10) worked, tks, haven't tried readall & writeall - i just came online for backup purposes

but I also asked what chars are detected in IsSeperator, IsSurrogate, IsWhteSpace, if u can please tell


And a new question has arrived

how can we programatically add or append rich text (rtf) in the rich text box

also how can we append text (simple or rich doesn't matter) at a specific location say this line, this column, or index

maqk at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 3

Me.RichTextBox1.SelectionStart = Me.RichTextBox1.TextLength

Me.RichTextBox1.Rtf = "ABC"

Me.RichTextBox1.AppendText("ABC")

DMan1 at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic IDE...
# 4

Hello there,

Me too, I was trying to append rtf text to rich text box:

Me.RichTextBox1.SelectionStart = Me.RichTextBox1.TextLength

Me.RichTextBox1.AppendText(rtfText)

This worked perfectly.

Thank a lot.

Kukita at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic IDE...