logo
VitNX3 Documentation

# File.SaveTextDialog Method

Namespace: VitNX3.Functions.FileSystem
Assembly: VitNX3 (in VitNX3.dll)
Saves the text dialog.
VB
C#
F#
C++
JScript
Copy

    public static void SaveTextDialog(
       string fileExtension = "*.txt",
       string filter = "Text files|*.txt",
       string text = "Hi!"
    )

    This language is not supported or no code example is available.

#### Parameters

fileExtension
  string

The file extension.

filter
  string

The filter.

text
  string

The text.

Source code
VB
C#
F#
C++
JScript
Copy

    public static void SaveTextDialog(string fileExtension = "*.txt",
         string filter = "Text files|*.txt",
         string text = "Hi!")
     {
         SaveFileDialog saveFile1 = new SaveFileDialog();
         saveFile1.DefaultExt = fileExtension;
         saveFile1.Filter = filter;
         if (saveFile1.ShowDialog() == DialogResult.OK && saveFile1.FileName.Length > 0)
         {
             using (StreamWriter sw = new StreamWriter(saveFile1.FileName, true))
             {
                 sw.WriteLine(text);
                 sw.Close();
             }
         }
     }

    This language is not supported or no code example is available.

Applies to

#### .NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

#### .NET Core

Supported in: 5.0+, 6.0+
See Also
File Class
VitNX3.Functions.FileSystem Namespace