richtextbox1.text=""; or richtextbox1.clear();
the above code will only work on first tab and clear the first tab text only..
please if any one have the logic then put it into my below winform code...
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 my_notepad
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
RichTextBox rh = new RichTextBox();
rh.Size = new System.Drawing.Size(1015, 750);
TabPage tb = new TabPage("new");
tabControl1.TabPages.Add(tb);
tb.Controls.Add(rh);
}
private void clearTextToolStripMenuItem_Click(object sender, EventArgs e)
{
tabControl1.SelectedIndex = -1;
richTextBox1.Text = "";
}
private void colourToolStripMenuItem_Click(object sender, EventArgs e)
{
if (colorDialog1.ShowDialog() != DialogResult.Cancel)
{
richTextBox1.ForeColor = colorDialog1.Color;
}
}
private void fontToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (fontDialog1.ShowDialog() != DialogResult.Cancel)
{
richTextBox1.Font = fontDialog1.Font;
}
}
}
}

New Topic/Question
Reply




MultiQuote








|