Saturday 23 July 2011

C# How to Create a text.txt

In this section we going to discuss about how we going to create a text file *.txt by using C#.
The commands we going to used is StreamReader. Before that remember add a library using System.IO;

Programming Look Like
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;

namespace Try_an_Error
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();      
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (!textBox1.Text.Equals(null))
            {
                StreamWriter Password = File.CreateText("C:\\Users\\patrick\\Deskt
                \\"+textBox1.text+".txt");
            }
        }    
    }
}

No comments:

Post a Comment