بسم الله الر حمن الر حيم
Same as SaveFile, loadFile method is also used by richTextBox, but its function is different from SaveFile. LoadFile function to load / retrieve data from disk to display in richTexBox. Youcan use openDialog to load or coding, same
Method LoadFile using openDialog is:
private void btnOpenFile_Click(object sender, System.EventArgs e)
{
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText);
}
}
And loadFile with code:
private void btnOpenFile_Click(object sender, System.EventArgs e)
{
string nameOfString = "nameOfFile.txt";
richTextBox2.LoadFile(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyComputer) + @"c:\MyFolder\" + nameOfString, RichTextBoxStreamType.PlainText);
}
Alhamdulillah, Hopefully helpful,,,
No comments:
Post a Comment