在指定文件夹下建立文本文档,文档名为 文本标题(txtbox中获得)+创建时间
------解决方案--------------------
System.IO.File.WriteAllLines(string.Format("{0}\\{1} {2}.txt", 指定目录, textBox1.Text , DateTime.Now.ToString("yyyyMMddhhmmss")), new string[] { "" });
------解决方案--------------------
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fs As FileStream = New FileStream("C:\" + Me.TextBox1.Text + Now().ToString("yyMMdd") + ".txt", FileMode.Create)
Dim sw As StreamWriter = New StreamWriter(fs)
sw.Write(Me.TextBox1.Text)
sw.Flush()
sw.Close()
fs.Close()
MessageBox.Show("OK")
End Sub
End Class