5

我有一个名为 TextEditPro 的程序,我刚刚启动它,我遇到了问题。

当我有点击另存为的代码时......我不知道如何使用保存文件对话框,所以当你点击另存为时它会弹出!

有什么帮助吗?

4

1 回答 1

11

学习使用MSDN -文档SaveFileDialog一个示例

Private Sub button1_Click(sender As Object, e As System.EventArgs)
    Dim myStream As Stream
    Dim saveFileDialog1 As New SaveFileDialog()

    saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
    saveFileDialog1.FilterIndex = 2
    saveFileDialog1.RestoreDirectory = True 

    If saveFileDialog1.ShowDialog() = DialogResult.OK Then
        myStream = saveFileDialog1.OpenFile()
        If (myStream IsNot Nothing) Then 
            ' Code to write the stream goes here.
            myStream.Close()
        End If 
    End If 
End Sub
于 2013-03-02T01:54:44.497 回答