Properties & Events With TextBox Class



TextBox:-
  • Text box is used to accept data from the user and also display data to user dynamically

  • Naming Convension     :        txtXXXX

  • Default  Event of the TextBox is TextChanged Event
 

Properties With TextBox Class

SNO

Property  &                                                 Options

Type
Description
01
BackColor
struct
Used to set or get Back ground color of the control

02
Border Style
    None
    Single
    Fixed3D (Default)
enum
None:        No Border appears to the
                 TextBox
Single:      Single Line Border appears
                  to the TextBox
Fixed3D:  3D Border appears to the
                  TextBox

03
 CharacterCasing
    Normal (Default)
    Lower
    Upper
enum
Normal: Data in the Textbox appears
                in the case it is typed
Lower: Data in the TextBox appears i
              in Lower case
Upper: Data in the TextBox appears
             in Upper case letters

04
Dock
      Top
    Left
    Bottom
    Right
    Fill
    None(Default)
enum
Top: Control is arranged on the top
          border of the form
Left: Control is arranged on the left
          border of the form
Bottom: Control is arranged on the
               bottom border of the form
Right: Control is arranged on the right
           border of the form
Fill:   Control is arranged with in the
           complete form
None: Control can be placed any
            where in the form
05
Enabled
     True (Default)
     False
bool
True: Control can be accessed at run
           time
False: Control cannot be accessed at
           run time

06
 Font

Used to set or get font attributes like Size, Style, Name etc., of the control

07
 ForeColor
enum
Used to set or get foreground ground color of the control

08
Location
    X (Left)
    Y(Left)
struct
Used to set or get the distance of the control from the top and left borders of the form

09
MaxLength
int
Used to set or get the maximum number of characters that user can be allowed to enter in the Textbox, Default value is 32767, when set to 0 user can be allowed to enter 1GB characters for single line textbox and 4GB characters for multi line textbox

10
Modifiers
      Private(Default)
      Protected
      Internal
      ProtectedInternal
      Public

Used to set or get the required accessibility for the control
(Refer the table in Inheritance chapter for the detailed description of the Modifiers)


11
MultiLine
     True
     False(Default)
bool
True: Data in the textbox appears in
          More than one lines
False: Data in the textbox appears
            One line

12
Name
char
Specifies the name of the control or
Indicates the Name used in code to identify the object.
13
PasswordChar
char
Used to set or get an alternate character to be appeared in textbox like password field. It is possible to set any character from the keyboard or space. But 2 or more characters are not allowed. PasswordChar will work when Multi Line is false only

14
ReadOnly
     True
      False(Default)
bool
True: Data in the textbox is editable
False: Data in the textbox is not
           Editable

15
ScrollBars
   None(Default)
   Horizontal
   Vertical
   Both
enum
None: No scrollbar appears to the
           control
Horizontal: Horizontal scrollbar
                   appears to the control
Vertical: Vertical scrollbar appears to
                the control
Both: Both scrollbar appears to the
           control
16
Size
    Height
     Width
struct
Used to set or get height and width of the control
17
TabIndex

Determines index value of the control in the TAB order
18
Text
int
Used to set or get the data into the textbox control
19
TextAlign
     Left(Default)
     Right
     Center

Left: Data in the Textbox appears with
        left Alignment
Right: Data in the Textbox appears
            with right Alignment
Center: Data in the Textbox appears
             with center Alignment
20
Visible
    True(Default)
    False
bool
True: Control appears at design time
          and also at run time
False: Control appears at design time
           but not at run time
21
WordWrap
     True(Default)
      False
bool
True: Data is wrapped automatically
           to the next line for multi line
          textbox
False: Data is not wrapped
            automatically to the next line
            for multi line textbox

In the above properties most of the properties are same for all other controls and few properties are different, so for other controls the different properties are discussed


Events Associated with TextBox Class

SNo
Name
Description
01
Click
Occurs when the textbox is clicked
02
DoubleClick
Occurs when the control is double-clicked
03
Enter
Occurs when the control is entered
04
FontChanged
Occurs when the Font property value changes
05
ForeColorChanged
Occurs when the ForeColor property value changes

06
Invalidated
Occurs when a control’s display requires redrawing
07
KeyDown
Occurs when a key is pressed while the control has focus
08
KeyPress
Occurs when a key is pressed while the control has focus
09
KeyUp
Occurs when a key is released while the control has focus
10
Leave
Occurs when the input focus leaves the control
11
LocationChanged
Occurs when the Location property value has changed
12
MouseClick
Occurs when the control is double clicked by the mouse
13
MouseDoubleClick
Occurs when the control is double clicked by the mouse
14
MouseDown
Occurs when the mouse pointer is over the control and a mouse button is pressed
15
MouseEnter
Occurs when the mouse pointer enters the control
16
MouseHover
Occurs when the mouse pointer rests on the control
17
MouseLeave
Occurs when the mouse pointer leaves the control
18
MouseMove
Occurs when the mouse pointer is moved over the control
19
MouseUp
Occurs when the mouse wheel moves while the control has focus
20
MouseWheel
Occurs when the mouse wheel moves while the control has focus
21
Move
Occurs when the control is moved
22
TextAlignChanged
Occurs when the TextAlign property value changed
23
TextChanged
Occurs when the Text property value changes
24
Validated
Occurs when the control is finished validating
25
Validating
Occurs when the control is validating


No comments:

Post a Comment