SpeakComputers.com
Home
Software
Electronics
Desktop Computers
Laptops
Games
Handheld Devices
Mobile Phones
Cameras
Camcorders
Printers
Books
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010
ASP.NET C# VB.NET C++ .NET Infragistics DevComponents

TextBox Control.

The TextBox control is typically used by the user to enter some text into part of the application or form. More commonly used to enter small text data, it can be used with the multiline feature for longer text fields. You can also limit the text length field as well as use the control for special fields as passwords. The text entered in the textbox field can be used to update a database field, written to new file or update an exiting file. It is a control that is found in most if not all software programs.



Namespace: System.Windows.Forms
Assembly: Systems.Windows.Forms.dll

using System.Windows.Forms;
Calling: System.Windows.Forms.TextBox

Creating a new System.Windows.Forms.TextBox control.
TextBox textBox1 = new TextBox();

Adding the TextBox control to a Windows form.
this.Controls.Add(textBox1);

Placing the TextBox on the form at a specific location.
textBox1.Location = new Point(50, 50);

Assigning a text value to a TextBox control.
textBox1.Text = "Enter";

Assigning a TextChanged event to the TextBox control.
textBox1.TextChanged+=new EventHandler(textBox1_Click);

Responding to the TextChanged event.
private void textBox1_TextChanged(object sender, EventArgs e)
{
//The MessageBox is part of the System.Windows.Forms namespace.
MessageBox.Show("HelloWorld");
}

Changing the background color of the TextBox control.
textBox1.BackColor = System.Drawing.Color.Red;

To disable the TextBox control.
textBox1.Enabled = false;
Here the TextBox control is still visible (partially faded) but will not respond to any events. To re-enable the TextBox control you would set the Enabled property to true. When adding the TextBox control the default setting is for the control to be Enabled.

To set the TextBox control to multiline.
this.textBox1.Multiline = true;

To set the scrollbar values.
this.textBox1.ScrollBars = ScrollBars.Both;

Computer Security
AntiVirus Software
Internet Security
Parental Controls
Backup & Recovery
Computer Protection
Anti Malware
Photo & Video
Photo & Video Editing
Video Music
Desktop Publishing
Professional Design
Home Publishing
Clipart
Business & Accounting
Accounting
Payroll
Check Printing
TAX
H&R Block
Microsoft Office
Design
Graphic Design
Home Design
Garden Design
Interior Design
Computer Aided Design
3D Design
Students & Teacher
Adobe
Microsoft Office
Dragon Naturally Speaking
Corel Draw
Serif
Student/Teacher Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Home About Privacy Policy Resouces