VB.NET 单击按钮后,弹出保存文件对话框,把ListBox的内容保存到.txt中,每个item占一行

来源:百度知道 编辑:UC知道 时间:2024/07/02 07:59:15
请给出具体代码

SaveFileDialog1.Filter = "文本文档|*.txt"
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
FileOpen(1, SaveFileDialog1.FileName, IO.FileMode.Open, OpenAccess.Write)
For i As Integer = 0 To ListBox1.Items.Count - 1
Print(1, ListBox1.Items(i).ToString)
Next
FileClose(1)
End If