2017-02-28 48 views
0
Public Class Form1 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
     Dim objectreader As New System.IO.StreamReader(TextBox1.Text) 
     System.Diagnostics.Process.Start("TextBox2.Text = objectreader.ReadToEnd()") 
     objectreader.Close() 
    End Sub 
End Class 

我试图从那里我已经写入文件的路径的文本文件阅读。我已经能够打开使用System.Diagnostics.Process.Start()一个文件,我已经能够使用StreamReader文本文件阅读,但我不能涉及到它。如何采取从文本文件中的文本,并把它放在System.Diagnostics.Process.Start("here")打开该文件。我使用vb.net的Visual Studio 2013年从写在一个文本文件的路径打开一个文件?

回答

0

删除引号。你是不是提供一个字符串,你提供了一个方法调用的结果:

TextBox2.Text = objectreader.ReadToEnd() 
System.Diagnostics.Process.Start(TextBox2.Text)