File creation, read, write and delete

Code here:
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 file_creation_and_modification
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {



            if (!File.Exists("E:/fuckme.txt"))
            {
                File.Create("E:/fuckme.txt");
            }
            else
            {
                using (StreamWriter ri = new StreamWriter("E:/fuckme.txt"))
                {
                    ri.WriteLine("Ah! Ah! AAH! Fuck me! Uwwh!");

                }
            }
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            using (StreamReader ir= new StreamReader("E:/fuckme.txt"))
            {
                string bishal = ir.ReadLine();
                richTextBox1.Text = bishal;
            }
        }

        private void Button3_Click(object sender, EventArgs e)
        {
            if (File.Exists("E:/fuckme.txt"))
            {
                File.Delete("E:/fuckme.txt");
            }
            else {
                MessageBox.Show("You can't delete what has not been created!","File does not exist");
            }
        }
    }
}

  1.  

Source code here:

Comments

Popular posts from this blog

&& and || in C# application

My Google service terms and conditions