掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
指定した階層にテキスト出力するには? (ID:122271)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Dim year As String Dim month As Integer Dim day As Integer Dim datenow As DateTime = DateTime.Now Dim fyear, fmonth, fday As String Dim nendo, tuki, hiniti As String year = datenow.Year month = datenow.Month day = datenow.Day nendo = "年度" tuki = "月" hiniti = "日" If System.IO.Directory.Exists("X:\" & year & nendo) = False Then '年度ディレクトリが無いなら System.IO.Directory.CreateDirectory("X:\" & year & nendo) '年度ディレクトリを作成 ElseIf System.IO.Directory.Exists("X:\" & year & nendo) = True Then '年度ディレクトリがあるなら System.IO.Directory.SetCurrentDirectory("X:\" & year & nendo) '年度ディレクトリに移動 If System.IO.Directory.Exists(month & tuki) = False Then '月度ディレクトリが無いなら System.IO.Directory.CreateDirectory(month & tuki) '月度ディレクトリを作成 ElseIf System.IO.Directory.Exists(month & tuki) = True Then '月度ディレクトリがあるなら System.IO.Directory.SetCurrentDirectory(month & tuki) '月度ディレクトリに移動 If System.IO.File.Exists(day & hiniti) = False Then '日にちファイルが無いなら System.IO.File.CreateText(day & hiniti & ".txt") '日にちファイルを空で作成 FileClose() End If End If End If System.IO.Directory.SetCurrentDirectory("x:\" & year & nendo & month & tuki) Dim fw As New StreamWriter("X:\" & day & hiniti, False, _ System.Text.Encoding.GetEncoding(932)) fw.Write(ListBox1.Items) FileClose() End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.