TextBox.BorderStyle : TextBox « System.Windows.Forms « C# / C Sharp by API






TextBox.BorderStyle

  

using System;
using System.Drawing;
using System.Windows.Forms;

public class TextBoxTextChanged : Form
{
  TextBox txt;
  string strOriginal;

  public TextBoxTextChanged()
  {
    Size = new Size(300, 375);
               
    txt = new TextBox();
    txt.Parent = this;
    txt.Text = "Enter text here.";
    txt.Size = new Size(ClientSize.Width - 20, ClientSize.Height - 100);
    txt.Location = new Point(10,10);
    txt.TextChanged += new System.EventHandler(txt_TextChanged);
    txt.Multiline = true;
    txt.BorderStyle = BorderStyle.Fixed3D;
    txt.ScrollBars = ScrollBars.Vertical;
    txt.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
    strOriginal = txt.Text;

  }

  static void Main() 
  {
    Application.Run(new TextBoxTextChanged());
  }

  private void txt_TextChanged(object sender, EventArgs e)
  {
    if (strOriginal == txt.Text)
      txt.Modified = false;
    else
      txt.Modified = true;

    if (txt.Modified)
      MessageBox.Show("changed");
    else
      MessageBox.Show("no change");
  }
}  
    

   
    
  








Related examples in the same category

1.TextBox.AcceptsTab
2.TextBox.Anchor
3.TextBox.CanFocus
4.TextBox.Clear()
5.TextBox.Click
6.TextBox.ContextMenu
7.TextBox.ContainsFocus
8.TextBox.DataBindings
9.TextBox.DoDragDrop
10.TextBox.DragDrop
11.TextBox.DragEnter
12.TextBox.Focus()
13.TextBox.Focused
14.TextBox.GotFocus
15.TextBox.KeyPress
16.TextBox.Lines
17.TextBox.LostFocus
18.TextBox.Multiline
19.TextBox.MouseDown
20.TextBox.PasswordChar
21.TextBox.ScrollBars
22.TextBox.SelectAll()
23.TextBox.SelectedText
24.TextBox.SelectionLength
25.TextBox.TextChanged
26.TextBox.Validated
27.TextBox.Validating