我有一个名为TextEditPro的程序,我刚刚启动它,我遇到了一个问题.
当我有单击另存为的代码…我不知道如何使用savefiledialog所以当你点击另存为它会弹出!
有帮助吗?
学习使用
MSDN – SaveFileDialog的
documentation就是一个例子
原文链接:https://www.f2er.com/vb/255564.htmlPrivate 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