想写一个多功能记事本?
想写一个多功能记事本?但是不知道那个打开文件应该怎么写呢?如果有会的请告诉我下~~
OpenFileDialog myodf = NEW OpenFileDialog() ;
myodf.Filter = "*所有文件|*|.txt|*.txt|.cs|*.cs|.vb|*.vb|.htm|*.htm";
if( myodf.ShowDialog() == Windows.Forms.DialogResult.OK)
{
string filePath = "";
filePath = myodf.FileName;
if ( filePath == "" )
{
Return;
}
else
{
try
{
this.RichTextBox1.LoadFile(filePath, RichTextBoxStreamType.PlainText);
}
catch
{
MessageBox.Show("文件类型不正确!", "系统提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}