2017-02-28 47 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)