我做了一个菜单条,我需要知道如何制作我必须保存的选项实际保存。
我使用Me.Close
作为关闭选项,我只需要知道如何保存。
感谢!
来自评论
这就是我所拥有的......虽然保存显然是错误的。
Private Sub SaveToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveToolStripMenuItem.Click
SaveToolStripMenuItem.DropDownItems("Save").Enabled = False
End Sub
答案 0 :(得分:4)
Private Sub SaveToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Using writer As StreamWriter = New StreamWriter("book_list.txt", True)
For Each line As String In ListBox1.Items
writer.WriteLine(line)
Next
End Using
End Sub
假设您的ListBox
被称为ListBox1