Multiline TextBox : TextBox « GUI Windows Forms « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » GUI Windows Forms » TextBox 
23.17.12.Multiline TextBox
Multiline TextBox
using System;
using System.ComponentModel;
using System.Windows.Forms;

public class TextBoxMultiline : System.Windows.Forms.Form
{
    private System.ComponentModel.Container components = null;
  private System.Windows.Forms.Button btnPasswordDecoderRing;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.TextBox passwordBox;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.TextBox capsOnlyBox;
  private System.Windows.Forms.Button btnGetMultiLineText;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.TextBox multiLineBox;

    public TextBoxMultiline()
    {
        InitializeComponent();
    CenterToScreen();
    }

  protected override void Disposebool disposing )
  {
    ifdisposing )
    {
      if (components != null
      {
        components.Dispose();
      }
    }
    base.Disposedisposing );
  }

  private void InitializeComponent()
  {
    this.capsOnlyBox = new System.Windows.Forms.TextBox();
    this.multiLineBox = new System.Windows.Forms.TextBox();
    this.label1 = new System.Windows.Forms.Label();
    this.label2 = new System.Windows.Forms.Label();
    this.passwordBox = new System.Windows.Forms.TextBox();
    this.btnGetMultiLineText = new System.Windows.Forms.Button();
    this.btnPasswordDecoderRing = new System.Windows.Forms.Button();
    this.label3 = new System.Windows.Forms.Label();
    this.SuspendLayout();
    // 
    // capsOnlyBox
    // 
    this.capsOnlyBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
    this.capsOnlyBox.Location = new System.Drawing.Point(14176);
    this.capsOnlyBox.Name = "capsOnlyBox";
    this.capsOnlyBox.Size = new System.Drawing.Size(12020);
    this.capsOnlyBox.TabIndex = 3;
    this.capsOnlyBox.Text = "";
    // 
    // multiLineBox
    // 
    this.multiLineBox.AcceptsReturn = true;
    this.multiLineBox.AcceptsTab = true;
    this.multiLineBox.Location = new System.Drawing.Point(1528);
    this.multiLineBox.Multiline = true;
    this.multiLineBox.Name = "multiLineBox";
    this.multiLineBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
    this.multiLineBox.Size = new System.Drawing.Size(240104);
    this.multiLineBox.TabIndex = 0;
    this.multiLineBox.Text = "Type some stuff here (and hit the return and tab keys...)";
    // 
    // label1
    // 
    this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif"10F);
    this.label1.Location = new System.Drawing.Point(88);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(13656);
    this.label1.TabIndex = 1;
    this.label1.Text = "A multiline textbox that accepts tabs and return keystrokes.";
    // 
    // label2
    // 
    this.label2.Font = new System.Drawing.Font("Comic Sans MS"12F);
    this.label2.Location = new System.Drawing.Point(14144);
    this.label2.Name = "label2";
    this.label2.Size = new System.Drawing.Size(10624);
    this.label2.TabIndex = 4;
    this.label2.Text = "Caps only!!";
    // 
    // passwordBox
    // 
    this.passwordBox.Location = new System.Drawing.Point(160176);
    this.passwordBox.Name = "passwordBox";
    this.passwordBox.PasswordChar = '$';
    this.passwordBox.Size = new System.Drawing.Size(23220);
    this.passwordBox.TabIndex = 5;
    this.passwordBox.Text = "COM seems so old fashion";
    // 
    // btnGetMultiLineText
    // 
    this.btnGetMultiLineText.Location = new System.Drawing.Point(1372);
    this.btnGetMultiLineText.Name = "btnGetMultiLineText";
    this.btnGetMultiLineText.Size = new System.Drawing.Size(12032);
    this.btnGetMultiLineText.TabIndex = 2;
    this.btnGetMultiLineText.Text = "Get Text";
    this.btnGetMultiLineText.Click += new System.EventHandler(this.btnGetMultiLineText_Click);
    // 
    // btnPasswordDecoderRing
    // 
    this.btnPasswordDecoderRing.Location = new System.Drawing.Point(280144);
    this.btnPasswordDecoderRing.Name = "btnPasswordDecoderRing";
    this.btnPasswordDecoderRing.Size = new System.Drawing.Size(11224);
    this.btnPasswordDecoderRing.TabIndex = 7;
    this.btnPasswordDecoderRing.Text = "Decode Password";
    this.btnPasswordDecoderRing.Click += new System.EventHandler(this.btnPasswordDecoderRing_Click);
    // 
    // label3
    // 
    this.label3.Font = new System.Drawing.Font("Comic Sans MS"12F);
    this.label3.Location = new System.Drawing.Point(152144);
    this.label3.Name = "label3";
    this.label3.Size = new System.Drawing.Size(12024);
    this.label3.TabIndex = 6;
    this.label3.Text = "Password Box";
    // 
    // TextBoxMultiline
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(513);
    this.ClientSize = new System.Drawing.Size(408221);
    this.Controls.Add(this.btnPasswordDecoderRing);
    this.Controls.Add(this.label3);
    this.Controls.Add(this.passwordBox);
    this.Controls.Add(this.label2);
    this.Controls.Add(this.capsOnlyBox);
    this.Controls.Add(this.btnGetMultiLineText);
    this.Controls.Add(this.label1);
    this.Controls.Add(this.multiLineBox);
    this.Name = "TextBoxMultiline";
    this.Text = "TextBox Types";
    this.ResumeLayout(false);

  }

  protected void btnPasswordDecoderRing_Click (object sender, System.EventArgs e)
  {
    MessageBox.Show(passwordBox.Text, "Your password is:");
  }

  protected void btnGetMultiLineText_Click (object sender, System.EventArgs e)
  {
    MessageBox.Show(multiLineBox.Text, "Here is your text");
  }

    public static void Main(string[] args
    {
        Application.Run(new TextBoxMultiline());
    }
}
23.17.TextBox
23.17.1.Get input value from TextBox and display it vis a messagebox
23.17.2.TextBox key pressed event
23.17.3.TextBox Modified and TextChangedTextBox Modified and TextChanged
23.17.4.TextBox: Multiline and BorderStyleTextBox: Multiline and BorderStyle
23.17.5.TextBox Keyevent handerTextBox Keyevent hander
23.17.6.TextBox cancel eventTextBox cancel event
23.17.7.Count lines in the TextBox and read text in TextBox line by lineCount lines in the TextBox and read text in TextBox line by line
23.17.8.TextBox selectionTextBox selection
23.17.9.TextBox validationTextBox validation
23.17.10.Add ContextMenu to TextBoxAdd ContextMenu to TextBox
23.17.11.Use Regular Expression to Check the input for a TextBoxUse Regular Expression to Check the input for a TextBox
23.17.12.Multiline TextBoxMultiline TextBox
23.17.13.Simple Editor
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.