c sharp Text Box

A TextBox control accepts user input on a Form. In this article, I will discuss how to create a TextBox control in Windows Forms at design-time as well as run-time. After that, I will continue discussing various properties and methods available for the TextBox control.
Creating a TextBox
you  can create a TextBox control using a Forms designer at design-time or using the TextBox class in code at run-time (.
To create a TextBox control at design-time, you simply drag and drop a TextBox control from Toolbox to a Form in Visual Studio. After you drag and drop a TextBox on a Form, the TextBox looks like Figure 1. Once a TextBox is on the Form, you can move it around and resize it using mouse and set its properties and events. 
 
 in above pic we can see see all Properties of text box control in C# .
Enabling and Disabling Shortcuts:
ShortcutsEnabled property of the TextBox is used to enable or disable shortcuts. By default, shortcuts are enabled. The following code snippet disables shortcuts in a TextBox.
dynamicTextBox.ShortcutsEnabled = false;
ShortcutsEnabled property applies to the following shortcut key combinations:
  • CTRL+Z
  • CTRL+E
  • CTRL+C
  • CTRL+Y
  • CTRL+X
  • CTRL+BACKSPACE
  • CTRL+V
  • CTRL+DELETE
  • CTRL+A
  • SHIFT+DELETE
  • CTRL+L
  • SHIFT+INSERT
  • CTRL+R

Password Character and Character Casing:
PasswordChar property is used to apply masking on a TextBox when you need to use it for a  password input and do now what password to be readable. For example, you can place a star (*) for password characters.
The following code snippet sets a dollar ($) symbol as any character entered in a TextBox.
dynamicTextBox.PasswordChar = '$';
UseSystemPasswordChar property is used to full default system password If the UseSystemPasswordChar is set to true, the default system password character is used and any character set by PasswordChar is ignored.

CharacterCasing property of TextBox sets the case of text in a TextBox, It has three values – Upper, Lower, and Normal.
 
dynamicTextBox.CharacterCasing = CharacterCasing.Upper;

No comments:

Post a Comment

Sending SMS Via Windows Form Application Using any Android Smart Phone  Source Code  using System ; using System . C...