【问题标题】:How to view a text file in a richtextbox without a openfiledialog in VB.NET [closed]如何在没有打开文件对话框的情况下在 VB.NET 中查看富文本框中的文本文件 [关闭]
【发布时间】:2014-10-23 16:33:49
【问题描述】:

我想在不使用 VB.NET 中的 OpenFileDialog 的情况下将文本文件打开到 Richtextbox 中

【问题讨论】:

  • richTextBox1.LoadFile("C:\MyDocument.rtf")

标签: vb.net richtextbox openfiledialog


【解决方案1】:

在 VB.NET 2012 中。类似这样的工作

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Me.RichTextBox1.LoadFile("C:\MyDocument.rtf", RichTextBoxStreamType.PlainText)
    End Sub
End Class

看看 RichTextBoxStreamType 枚举

http://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.richtextboxstreamtype(v=vs.90).aspx

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-13
    • 2012-02-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多