1
streamWriterの使い方を読んでいるPreserving existing text when writing to file でも、私のコードは事実上同じですが、何も何もしなくてもファイルに書き込まれます。ここでのコードは次のとおりです。ストリームライターでファイルにラインを書き込む
Private Sub Main()
Dim todaysdate As String = DateTime.Today
todaysdate = todaysdate.Replace("/", ".")
Dim todayFile As String = "dated\" & todaysdate & ".txt."
'this just creates the name and filepath that i want my file to be located at
If File.Exists(todayFile) = False Then
Dim Day As StreamWriter
Day = New StreamWriter(todayFile, True)
Day.WriteLine("sandwhich")
end if
end sub
はそうええ、これは文字通りのファイルを作成します(そこには問題は、ファイルが正しい日付と場所で行われていない)が、私は、ファイルを開いたとき、それは空です!助言がありますか?