Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fn As String = InputBox("请输入文件名,不需要.TXT后缀", "提示")
If fn <> "" Then
fn = My.Computer.FileSystem.CombinePath(Application.StartupPath, fn & ".txt") '当前路径和输入文件名组合
My.Computer.FileSystem.WriteAllText(fn, TextBox1.Text, My.Computer.FileSystem.FileExists(fn)) '如果文件已存在,则追加内容,否则建立新文件
End If
End Sub
追问虽然采纳了别人,不过还是谢谢你了
追答晕,选路径就更简单了,就是看你题目是当前程序目录,才这么写代码的!