<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FGUI%2FDialog_File_Save_Open</id>
		<title>VB.Net/GUI/Dialog File Save Open - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FGUI%2FDialog_File_Save_Open"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_File_Save_Open&amp;action=history"/>
		<updated>2026-04-05T05:57:42Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_File_Save_Open&amp;diff=550&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_File_Save_Open&amp;diff=550&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_File_Save_Open&amp;diff=551&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_File_Save_Open&amp;diff=551&amp;oldid=prev"/>
				<updated>2010-05-26T12:44:28Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Add action Listener to Save Button on A Save File Dialog==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Diagnostics&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Dim  WithEvents dlgSaveData As System.Windows.Forms.SaveFileDialog&lt;br /&gt;
    &lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        dlgSaveData = New System.Windows.Forms.SaveFileDialog&lt;br /&gt;
        If dlgSaveData.ShowDialog() = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            MessageBox.Show(dlgSaveData.FileName)&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    &lt;br /&gt;
    Shared Private Sub dlgSaveData_FileOk(ByVal sender As Object, _&lt;br /&gt;
     ByVal e As System.ruponentModel.CancelEventArgs) Handles dlgSaveData.FileOk&lt;br /&gt;
        &lt;br /&gt;
        &lt;br /&gt;
        If Not dlgSaveData.FileName.EndsWith(&amp;quot;.dat&amp;quot;) Then&lt;br /&gt;
            MsgBox(&amp;quot;File &amp;quot; &amp;amp; dlgSaveData.FileName &amp;amp; _&lt;br /&gt;
                &amp;quot; is not a .dat file&amp;quot;, _&lt;br /&gt;
                MsgBoxStyle.Exclamation, _&lt;br /&gt;
                &amp;quot;Invalid File Type&amp;quot;)&lt;br /&gt;
            e.Cancel = True&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub    &lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File open dialog==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.Configuration&lt;br /&gt;
Imports System.Resources&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim dlg As OpenFileDialog = New OpenFileDialog()&lt;br /&gt;
        Dim res As DialogResult = dlg.ShowDialog()&lt;br /&gt;
        If res = DialogResult.OK Then&lt;br /&gt;
            MessageBox.Show(&amp;quot;You picked: &amp;quot; &amp;amp; dlg.FileName)&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File Open dialog: file filter==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.Configuration&lt;br /&gt;
Imports System.Resources&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        &amp;quot;Declare a OpenFileDialog object&lt;br /&gt;
        Dim objOpenFileDialog As New OpenFileDialog&lt;br /&gt;
        &amp;quot;Set the Open dialog properties&lt;br /&gt;
        With objOpenFileDialog&lt;br /&gt;
            .Filter = &amp;quot;Text files (*.txt)|*.txt|All files (*.*)|*.*&amp;quot;&lt;br /&gt;
            .FilterIndex = 1&lt;br /&gt;
            .Title = &amp;quot;Demo Open File Dialog&amp;quot;&lt;br /&gt;
        End With&lt;br /&gt;
        &amp;quot;Show the Open dialog and if the user clicks the Open button,&lt;br /&gt;
        &amp;quot;load the file&lt;br /&gt;
        If objOpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            Dim allText As String&lt;br /&gt;
            Try&lt;br /&gt;
                &amp;quot;Read the contents of the file&lt;br /&gt;
                allText = My.ruputer.FileSystem.ReadAllText( _&lt;br /&gt;
                    objOpenFileDialog.FileName)&lt;br /&gt;
                &amp;quot;Display the file contents in the TextBox&lt;br /&gt;
                System.Console.WriteLine(allText)&lt;br /&gt;
            Catch fileException As Exception&lt;br /&gt;
                Throw fileException&lt;br /&gt;
            End Try&lt;br /&gt;
        End If&lt;br /&gt;
        &amp;quot;Clean up&lt;br /&gt;
        objOpenFileDialog.Dispose()&lt;br /&gt;
        objOpenFileDialog = Nothing&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File save dialog==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.Configuration&lt;br /&gt;
Imports System.Resources&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim dlg As SaveFileDialog = New SaveFileDialog()&lt;br /&gt;
        Dim res As DialogResult = dlg.ShowDialog()&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==File save dialog: File filter, Default name, Overwrite Prompt and title==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.Configuration&lt;br /&gt;
Imports System.Resources&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        &amp;quot;Declare a SaveFileDialog object&lt;br /&gt;
        Dim objSaveFileDialog As New SaveFileDialog&lt;br /&gt;
        &amp;quot;Set the Save dialog properties&lt;br /&gt;
        With objSaveFileDialog&lt;br /&gt;
            .DefaultExt = &amp;quot;txt&amp;quot;&lt;br /&gt;
            .FileName = &amp;quot;Test Document&amp;quot;&lt;br /&gt;
            .Filter = &amp;quot;Text files (*.txt)|*.txt|All files (*.*)|*.*&amp;quot;&lt;br /&gt;
            .FilterIndex = 1&lt;br /&gt;
            .OverwritePrompt = True&lt;br /&gt;
            .Title = &amp;quot;Demo Save File Dialog&amp;quot;&lt;br /&gt;
        End With&lt;br /&gt;
        &amp;quot;Show the Save dialog and if the user clicks the Save button,&lt;br /&gt;
        &amp;quot;save the file&lt;br /&gt;
        If objSaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            Try&lt;br /&gt;
                Dim filePath As String&lt;br /&gt;
                &amp;quot;Open or Create the file&lt;br /&gt;
                filePath = System.IO.Path.rubine( _&lt;br /&gt;
                    My.ruputer.FileSystem.SpecialDirectories.MyDocuments, _&lt;br /&gt;
                    objSaveFileDialog.FileName)&lt;br /&gt;
                &amp;quot;Replace the contents of the file&lt;br /&gt;
                My.ruputer.FileSystem.WriteAllText(filePath, &amp;quot;C:\\a.txt&amp;quot;, False)&lt;br /&gt;
            Catch fileException As Exception&lt;br /&gt;
                Throw fileException&lt;br /&gt;
            End Try&lt;br /&gt;
        End If&lt;br /&gt;
        &amp;quot;Clean up&lt;br /&gt;
        objSaveFileDialog.Dispose()&lt;br /&gt;
        objSaveFileDialog = Nothing&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Open file dialog: Filter,Initial Directory,Title, CheckFileExists ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim myFileDialog As OpenFileDialog = New OpenFileDialog()&lt;br /&gt;
        With myFileDialog&lt;br /&gt;
            .Filter = &amp;quot;Text files (*.txt)|*.txt|All files (*.*)|*.*&amp;quot;&lt;br /&gt;
            .FilterIndex = 1&lt;br /&gt;
            .InitialDirectory = &amp;quot;C:\&amp;quot;&lt;br /&gt;
            .Title = &amp;quot;Open File&amp;quot;&lt;br /&gt;
            .CheckFileExists = False&lt;br /&gt;
        End With&lt;br /&gt;
        If myFileDialog.ShowDialog() = DialogResult.OK Then&lt;br /&gt;
            Console.WriteLine(myFileDialog.FileName)&lt;br /&gt;
        End If&lt;br /&gt;
        myFileDialog = Nothing&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>