vb中的菜单条保存选项

时间:2012-10-04 19:35:44

标签: vb.net save

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

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

感谢!


来自评论

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

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

1 个答案:

答案 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