private void ReadFiles(string path)
{
try
{
Stream stream = new FileStream(path,FileMode.Open);
FileInfo fileinfo = new FileInfo(path);
string fileExtension = fileinfo.Extension.ToUpper();
if (fileExtension.Equals(".RTF"))
{
this.textBox1.LoadFile(stream, RichTextBoxStreamType.RichText);
(c:\users\ibm_admin\documents\visual studio 2010\Projects\CS_TEST_APP_002\Form1.cs(230,35): error CS1061: 'System.Windows.Forms.TextBox' does not contain a definition for 'LoadFile' and no extension method 'LoadFile' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?))(这个错误是怎么回事啊)
}
else
{
this.textBox1.LoadFile(stream, RichTextBoxStreamType.PlainText);
}
stream.Close();
}
catch { return; }
}
微软提供的Textbox类是没有这方法的,如果你在其他地方看到,可能是其他人进行了自己的扩展。所以你应该拷贝其他人的对应的扩展类。并引用。
TextBox有这个方法?
没有,但是在做treeview是他是个自动调用,我也不知道啊