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 :) –