VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > VB.net教程 >
  • VB.NET===关于OpenFileDialog, SaveFileDialog的控件的例程

'打开
Private Sub 打开ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 打开ToolStripMenuItem.Click
OpenFileDialog1.InitialDirectory = “c:” '设置默认位置
OpenFileDialog1.Filter = “txt file (.txt)|.txt|All Files(.)|(.)” '设置文件过滤器
OpenFileDialog1.Title = “打开文件” '设置对话框标题
OpenFileDialog1.ShowDialog() '显示打开对话框
End Sub
‘保存
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button3.Click
Dim SaveFileDialog1 As SaveFileDialog = New SaveFileDialog()
If RichTextBox1.TextLength > 0 Then
SaveFileDialog1.Filter = “Text files (.txt)|.txt|All Files(.)|(.)”
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName <> “” Then
RichTextBox1.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)
End If
End If
End Sub
————————————————
版权声明:本文为CSDN博主「晴、天」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_46142047/article/details/103914311
 

相关教程