Create Notepad using C#

Поділитися
Вставка
  • Опубліковано 31 жов 2024

КОМЕНТАРІ • 43

  • @codingwithlibino
    @codingwithlibino  4 роки тому +12

    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 New_Notepad
    {
    public partial class Form1 : Form
    {
    string filePath = ""; // Used to store the file location
    public Form1()
    {
    InitializeComponent();
    }
    private void newToolStripMenuItem_Click(object sender, EventArgs e)
    {
    filePath = "";
    richTextBox1.Text = "";
    }
    private void openToolStripMenuItem_Click(object sender, EventArgs e)
    {
    //Code for open a txt file
    using (OpenFileDialog ofd=new OpenFileDialog(){Filter="TextDocument|*.txt",ValidateNames=true,Multiselect=false})
    {
    if (ofd.ShowDialog()==DialogResult.OK)
    {
    using (StreamReader sr=new StreamReader(ofd.FileName))
    {
    filePath = ofd.FileName;
    Task text = sr.ReadToEndAsync();
    richTextBox1.Text = text.Result;
    }
    }
    }
    }
    private void saveToolStripMenuItem_Click(object sender, EventArgs e)
    {
    if (string.IsNullOrEmpty(filePath))
    {
    using(SaveFileDialog sfd=new SaveFileDialog(){Filter="Textdocument|*.txt",ValidateNames=true})
    {
    if(sfd.ShowDialog()==DialogResult.OK)
    {
    using(StreamWriter sw=new StreamWriter(sfd.FileName))
    {
    sw.WriteLineAsync(richTextBox1.Text);
    }
    }
    }
    }
    else{
    using(StreamWriter sw=new StreamWriter(filePath))
    {
    sw.WriteLineAsync(richTextBox1.Text);
    }
    }
    }
    private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
    {
    //We can also use the save file coding here
    using (SaveFileDialog sfd = new SaveFileDialog() { Filter = "Textdocument|*.txt", ValidateNames = true })
    {
    if (sfd.ShowDialog() == DialogResult.OK)
    {
    using (StreamWriter sw = new StreamWriter(sfd.FileName))
    {
    sw.WriteLineAsync(richTextBox1.Text);
    }
    }
    }
    }
    private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e)
    {
    printPreviewDialog1.Document = printDocument1;
    printPreviewDialog1.ShowDialog();
    }
    private void printToolStripMenuItem_Click(object sender, EventArgs e)
    {
    printPreviewDialog1.Document = printDocument1;
    if (printDialog1.ShowDialog()==DialogResult.OK)
    {
    printDocument1.Print();
    }
    }
    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    {
    //To close the application
    this.Close();
    }
    private void undoToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.Undo();
    }
    private void redoToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.Redo();
    }
    private void cutToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.Cut();
    }
    private void copyToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.Copy();
    }
    private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.Paste();
    }
    private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.SelectedText = "";
    }
    private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.SelectAll();
    }
    private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)
    {
    if (wordWrapToolStripMenuItem.Checked==true)
    {
    wordWrapToolStripMenuItem.Checked = false;
    richTextBox1.WordWrap = false;
    }
    else
    {
    wordWrapToolStripMenuItem.Checked = true;
    richTextBox1.WordWrap = true;
    }
    }
    private void fontToolStripMenuItem_Click(object sender, EventArgs e)
    {
    fontDialog1.ShowDialog();
    richTextBox1.SelectionFont = new Font(fontDialog1.Font.FontFamily, fontDialog1.Font.Size, fontDialog1.Font.Style);
    }
    private void highlightTextToolStripMenuItem_Click(object sender, EventArgs e)
    {
    richTextBox1.SelectionBackColor = Color.Yellow;
    }
    private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
    {
    About About = new About();
    About.ShowDialog();
    }
    private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
    e.Graphics.DrawString(richTextBox1.Text,richTextBox1.Font,Brushes.Black,12,10);
    }
    private void richTextBox1_TextChanged(object sender, EventArgs e)
    {
    if (richTextBox1.Text.Length>0)
    {
    cutToolStripMenuItem.Enabled = true;
    copyToolStripMenuItem.Enabled = true;
    }
    else
    {
    cutToolStripMenuItem.Enabled = false;
    copyToolStripMenuItem.Enabled = false;
    }
    }
    }
    }

  • @ridlinlc
    @ridlinlc 4 роки тому +3

    Nice Information

  • @ziciimcadde4660
    @ziciimcadde4660 3 роки тому +3

    Thank you Teacher this assignment whose sent me in ky university ana i just completed all design and their codes thanks you so much.

  • @Powerofpixel01
    @Powerofpixel01 3 роки тому +3

    thanks for assignment completion ...god bless you

  • @moscuvladut5018
    @moscuvladut5018 Рік тому +1

    thank you very much my friend

  • @HK-pw7bt
    @HK-pw7bt 2 роки тому +2

    thank you so much bro very helpfull
    keep it up

  • @swapnas16
    @swapnas16 4 роки тому +4

    Thanks for English subtitles...

  • @creatingcreations8647
    @creatingcreations8647 3 роки тому +2

    super bro, very very awesome i was searching for this video only, now I am a subscriber of your channel

    • @codingwithlibino
      @codingwithlibino  3 роки тому +2

      Thank you so much bro

    • @creatingcreations8647
      @creatingcreations8647 3 роки тому +2

      @@codingwithlibino teaching coding in Tamil is rare thanks for helping 😁👍👍👍❤️❤️

    • @codingwithlibino
      @codingwithlibino  3 роки тому +2

      Blogspot : dotnetintamils.blogspot.com/2021/06/create-notepad-using-c.html

    • @creatingcreations8647
      @creatingcreations8647 3 роки тому +2

      @@codingwithlibino thanks for sharing bro

  • @justinpes9118
    @justinpes9118 2 роки тому +1

    Thank you very very very Much

  • @bikashalterego
    @bikashalterego 4 роки тому +5

    Hey Bro, while making videos, just zoom in to your codes while writing codes... Its not clearly visible... Btw keep posting such good content bro....

    • @codingwithlibino
      @codingwithlibino  4 роки тому +1

      Thank you for your suggestions.

    • @codingwithlibino
      @codingwithlibino  3 роки тому

      Blogspot : dotnetintamils.blogspot.com/2021/06/create-notepad-using-c.html

  • @fatihfajral
    @fatihfajral 4 роки тому +2

    👍

  • @bloodmoonsolareclipse
    @bloodmoonsolareclipse 3 роки тому +2

    19:26

  • @pavankalyan6013
    @pavankalyan6013 3 роки тому +2

    I'm fresher..... Can u suggest me which book is good to learn the content and suggest more multiple examples.

  • @HK-pw7bt
    @HK-pw7bt 2 роки тому +2

    add video for traffic signal program using c#

  • @footballcomedychannel8015
    @footballcomedychannel8015 2 роки тому +1

    Thank you bro although the about code is not helping me but Thank you

  • @hannahisabelbugawisan7127
    @hannahisabelbugawisan7127 2 роки тому +1

    Sadly, the code didn't work on my Microsoft Visual Studio 2022 :< But thanks for the tutorial.

  • @bloodmoonsolareclipse
    @bloodmoonsolareclipse 3 роки тому +1

    35:11

  • @ukaszebkowski4795
    @ukaszebkowski4795 4 роки тому +2

    Exit and Cut the same shortcut Ctrl + X

    • @codingwithlibino
      @codingwithlibino  4 роки тому +1

      You can also use your own alphabets.

    • @codingwithlibino
      @codingwithlibino  3 роки тому

      Blogspot : dotnetintamils.blogspot.com/2021/06/create-notepad-using-c.html

  • @mehranaltaf47
    @mehranaltaf47 3 роки тому +3

    Bhai code nai hai description main

    • @youtubepromote9954
      @youtubepromote9954 3 роки тому +1

      It is placed in the comment section

    • @codingwithlibino
      @codingwithlibino  3 роки тому +1

      Blogspot : dotnetintamils.blogspot.com/2021/06/create-notepad-using-c.html

  • @bloodmoonsolareclipse
    @bloodmoonsolareclipse 3 роки тому +1

    16:52