Notepad through VB 2010
Hey Programmer Friends! In this tutorial I
am going to show you how to make an advanced
notepad in visual basic 2010 / 2008.
I will split this tutorial in to two (2) parts
PART 1 the design and behaviour of our application
And PART 2 the coding.
Let’s get started.
I will split this tutorial in to two (2) parts
PART 1 the design and behaviour of our application
And PART 2 the coding.
Let’s get started.
PART 1 –Design &
Behaviour
Open VB and go to File>New Project>Windows Form Application> Call it whatever you like.
Open VB and go to File>New Project>Windows Form Application> Call it whatever you like.
Ø Now
insert:
1 Menustrip
1 Text Box.
1 SavefileDialog
1 OpenfileDialog
1 FontDialog
make the form like These pictures
1 Menustrip
1 Text Box.
1 SavefileDialog
1 OpenfileDialog
1 FontDialog
make the form like These pictures
PART 2 - CODING
It’s the coding for different controls, and I think you understand that which code is for which controls. And for any other query leave a comment in comment box.
using System;
It’s the coding for different controls, and I think you understand that which code is for which controls. And for any other query leave a comment in comment box.
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;
namespace notepad_v
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void
openToolStripMenuItem_Click(object sender, EventArgs e)
{
//openFileDialog1.ShowDialog();
if
(openFileDialog1.ShowDialog()==System.Windows.Forms.DialogResult.OK)
{
textBox1.Text=System.IO.File.ReadAllText(openFileDialog1.FileName);
}
}
private void
saveToolStripMenuItem_Click(object sender, EventArgs e)
{
///saveFileDialog1.ShowDialog();
if
(saveFileDialog1.ShowDialog()==System.Windows.Forms.DialogResult.OK)
{
System.IO.File.WriteAllText(saveFileDialog1.FileName,textBox1.Text);
}
}
private void
saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
}
private void
fontToolStripMenuItem_Click(object sender, EventArgs e)
{
fontDialog1.ShowDialog();
}
private void
newToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
private void
undoToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Undo();
}
private void
cutToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Cut();
}
private void
copyToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Copy();
}
private void
pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
textBox1.Paste();
}
private void
selectAllToolStripMenuItem_Click(object sender,
EventArgs e)
{
textBox1.SelectAll();
}
private void
toolStripMenuItem2_Click(object sender, EventArgs e)
{
textBox1.SelectedText = "";
}
private void
fileToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}
I will update this code as I able to get code for other different tool.
0 comments