我有一个名为TextEditPro的程序,我刚刚启动它,我遇到了一个问题。
当我有点击另存为的代码时...我不知道如何使用savefiledialog所以当你点击另存为它会弹出!
任何帮助?
答案 0 :(得分:8)
学习使用MSDN - SaveFileDialog
的{{3}}有一个例子
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