Tuesday, July 14, 2009

C# 10 points for the best answer!!!!?

Hello everybody.


I need some C# tutorials or sources for writing in a RichTextBox the FileNames of a OpenFileDialog component.


How can I do this???


Thanks

C# 10 points for the best answer!!!!?
For using OpenFileDialog with richtextbox for loading *.rtf files in C#, learn it from the following code:





First of all drag and drop 3 controls on Windows form of your application:


1. Richtextbox


2. OpenDialogBox


3. Button





Now double click on button control to write the code for its click event to open the openFileDialog:





openFileDialog1.Filter = "Rich Text File(*.rtf)|*.rtf";


if( openFileDialog1.ShowDialog() != DialogResult.Cancel )


{


richTextBox1.LoadFile( openFileDialog1.FileName );


}





Similarly you can use the saveFileDialog to save the text of richtextbox. To append the old file text loaded in richtextbox you can use Richtextbox function:





richTextBox1.SaveFile( PASS THE FILE PATH HERE );





Hope above code will help you to load files in richtextbox.





Gud Luck :-)
Reply:http://www.csharp-station.com/Tutorial.a...
Reply:Specificially, these links have the command to append text to a RichTextBox.





so, something like this:








textBox.appendText(fileDialog.Filename...


No comments:

Post a Comment