Create Notepad using C#

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 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;
    }
    }
    }
    }

  • @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

  • @ridlinlc
    @ridlinlc 4 ปีที่แล้ว +3

    Nice Information

  • @justinpes9118
    @justinpes9118 2 ปีที่แล้ว +1

    Thank you very very very Much

  • @swapnas16
    @swapnas16 4 ปีที่แล้ว +4

    Thanks for English subtitles...

    • @codingwithlibino
      @codingwithlibino  4 ปีที่แล้ว +2

      Thank you so much

    • @codingwithlibino
      @codingwithlibino  3 ปีที่แล้ว

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

  • @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

  • @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

  • @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#

  • @fatihfajral
    @fatihfajral 4 ปีที่แล้ว +2

    👍

  • @bloodmoonsolareclipse
    @bloodmoonsolareclipse 3 ปีที่แล้ว +1

    16:52

  • @hannahisabelbugawisan7127
    @hannahisabelbugawisan7127 2 ปีที่แล้ว +1

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

  • @footballcomedychannel8015
    @footballcomedychannel8015 2 ปีที่แล้ว +1

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

  • @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

  • @bloodmoonsolareclipse
    @bloodmoonsolareclipse 3 ปีที่แล้ว +1

    35:11

  • @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 ปีที่แล้ว +2

    19:26