- This topic explains about the working of SaveFileDialog component in VB programming.
- With this you can save file into your location.
- Tools needed: Button1 (Button1), SaveFileDialog1 (SaveFileDialog1), RichTextBox1 (RichTextBox1)
VB.NET – Working of SaveFileDialog Component in VB
- VB.NET means Visual Basic.NET.
- It’s an OOP’s language.
- VB.NET is a .NET version of Visual Basic programming language.
- It uses CLR for program execution.
- According to Microsoft VB.NET was re-engineered rather than released as Visual Basic 6.0 with some add-ons.
- Different versions of VB.NET are available.
- Know more about VB.NET
SaveFileDialog Class – Working of SaveFileDialog Component in VB
- Help the user to select a location for saving a file.
- This class cannot be inherited.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
- Syntax for SaveFileDialog
|
1 2 3 |
'Declaration Public NotInheritable Class SaveFileDialog _ Inherits FileDialog |
CommonDialog.ShowDialog Method – Working of SaveFileDialog Component in VB
- Help to run a common dialog box with a default owner.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
- Syntax for ShowDialog
|
1 2 |
'Declaration Public Function ShowDialog As DialogResult |
FileDialog.FileName Property – Working of SaveFileDialog Component in VB
- Help to sets a string containing the file name selected in the file dialog box.
- Syntax
|
1 2 |
'Declaration Public Property FileName As String |
RichTextBox Class – Working of SaveFileDialog Component in VB
- Help to represent a windows rich text box.
- Syntax
|
1 2 3 4 5 6 |
'Declaration <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ <DockingAttribute(DockingBehavior.Ask)> _ Public Class RichTextBox _ Inherits TextBoxBase |
RichTextBox.SaveFile Method (String, RichTextBoxStreamType)
- Help to saves the contents of the RichTextBox to a specific type of file.
- Parameters
Path – The name and location of the file to save.
File Type – One of the RichTextBoxStreamType values.
Working of SaveFileDialog Component in VB – Complete Code
|
1 2 3 4 5 6 7 |
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click If SaveFileDialog1.ShowDialog() = DialogResult.OK Then RichTextBox1.SaveFile(SaveFileDialog1.FileName, _ RichTextBoxStreamType.PlainText) End If End Sub |
Working of SaveFileDialog Component in VB
If you have any suggestions or doubts regarding this topic, please contact us…






