1
找到要讀取的文件時,需要將\bob\
零件更改爲類似\%username%\
的幫助。在StreamReader上使用Environment.UserName
我一直在閱讀,一切都在說Environment.UserName
但我該如何將其添加到我目前的代碼?
Imports System.IO
Imports System
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sr As New StreamReader("C:\Users\bob\Dropbox\Apps\Attachments\my.txt")
Dim word As String = ""
Dim words(1000) As String
Dim i As Integer = 0
Do Until sr.Peek = -1
word = sr.ReadLine()
words(i) = word
mytext.AppendText(vbNewLine + vbNewLine + TimeOfDay + vbNewLine + vbNewLine + words(i) + vbNewLine + "__________________________________________")
i += 1
Loop
sr.Close()
End Sub
End Class
真棒隊友說做的伎倆;) –
@ENCORECo Cool :) –