Affichage des articles dont le libellé est Export RichTextBox Text To Text File. Afficher tous les articles
Affichage des articles dont le libellé est Export RichTextBox Text To Text File. Afficher tous les articles

C# Export RichTextBox Text To Text File

How To Export RichTextBox Text To Txt File In C#


In This C# Tutorial We Will See How To Write RichTexBox Text Into Txt File In CSharp 
Programming Language .


Project Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Export_Text_To_Text_File : Form
    {
        public Export_Text_To_Text_File()
        {
            InitializeComponent();
        }

        private void BTN_EXPORT_Click(object sender, EventArgs e)
        {

            TextWriter writer = new StreamWriter(@"C:\folder\Text.txt");

            writer.Write(richTextBox1.Text);

            writer.Close();

        }
    }
}

///////////////OUTPUT:

c# export text to text file




VB.NET Export RichTextBox Text To Text File

VB.NET - How To Export RichTextBox Text To Txt File In Visual Basic.NET


In This VB.NET Tutorial We Will See How To Write RichTexBox Text Into Txt File In Visual Basic .NET Programming Language .


Project Source Code:

Imports System.IO

Public Class Export_Text_To_Txt_File

    Private Sub BTN_EXPORT_Click(sender As Object, e As EventArgs) Handles BTN_EXPORT.Click

        Dim writer As TextWriter = New StreamWriter("C:\folder\Text.txt")

        writer.Write(RichTextBox1.Text)

        writer.Close()

        MessageBox.Show("Exported")

    End Sub
End Class

OUTPUT:

vb net export text to txt file