-2

我做了一个菜单条,我需要知道如何使我必须保存的选项实际保存。

我使用Me.Close关闭选项,我只需要知道如何保存。

感谢!


来自评论

这就是我所拥有的......虽然保存显然是错误的。

Private Sub SaveToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SaveToolStripMenuItem.Click 
    SaveToolStripMenuItem.DropDownItems("Save").Enabled = False 
End Sub 
4

1 回答 1

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

于 2012-10-04T19:49:44.603 回答