富文本框未加载RTF格式(ArgumentException)在Visual Basic中

时间:2016-08-07 17:31:20

标签: vb.net visual-studio

这是代码:

mat.LoadFile(path + "\text.rtf")

mat是一个富文本框。我仔细检查了路径,并且\ text.rtf 确实存在。我得到“找不到文件”错误,而是“不支持文件格式”,即使它是.rtf
例外细节:

System.ArgumentException was unhandled
  HResult=-2147024809
  Message=File format is not valid.
  Source=System.Windows.Forms
  StackTrace:
       at System.Windows.Forms.RichTextBox.StreamIn(Stream data, Int32 flags)
       at System.Windows.Forms.RichTextBox.LoadFile(Stream data, RichTextBoxStreamType fileType)
       at System.Windows.Forms.RichTextBox.LoadFile(String path, RichTextBoxStreamType fileType)
       at System.Windows.Forms.RichTextBox.LoadFile(String path)
       at Authorize.Form1.Form1_Load() in C:\Users\Hamoudy\documents\visual studio 2015\Projects\Authorize\Authorize\Form1.vb:line 18
       at Authorize.Form1._Lambda$__R0-1(Object a0, EventArgs a1)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: 

0 个答案:

没有答案