Pages

Monday, April 23, 2012

CLTextBox, an enhanced TextBox Control for .NET WinForms

CLTextBox is an open source enhanced TextBox Control for .NET WinForms.
This component extends the default version of the .NET TextBox with validation functions.



It adds a coloured box at the right side of the input box to let the user know the validation status.

The validation mode for the component is selectable under the Validation option:
  • Disabled
  • Enabled: if enabled the validation box will represent the validation status, red for invalid, green for valid
  • Enabled and Mandatory: if enabled the input will be validated and can not be empty

This component can run in the following modes, which are selectable in design time under the MaskType option:
  • Text
  • Long
  • Double
  • Time
  • Date
  • DateTime
  • List
  • TextAutoComplete
  • ComboBox
  • RegEx

Every mode can be customized editing some parameters.

Text
Input should be Text type, Max and Min value for the text lenght can be selected.

Long
Input should be Long numeric type, Max and Min value for the number can be selected.

Double
Input should be Double numeric type, Max and Min value for the number can be selected.

Time
Input should be a Time value, Max and Min value for the time can be selected.
RegEx of the time validation can be changed, a valid regex must contains "HH" and "MM" elements for hour and minute.
Default input mask is "HH:MM"

Date
Input should be a Date value, Max and Min value for the date can be selected.
RegEx of the date validation can be changed, a valid regex must contains "dd", "mm", and "yy" elements for day, month and year.
Default input mask is "dd/mm/yyyy"

Date Time
Input should be a Date and Time value, Max and Min value for the date and time can be selected.
RegEx of the date and time validation can be changed, a valid regex must contains "dd", "mm", "yy", "HH and "MM" elements for day, month, year, hour and minute, default input mask is "dd/mm/yyyy HH:MM"

List
This mode let the user select from a list of values. The list appears when the user double click on the control.
A delegate_DataLoad and a delegate_CellDoubleClick should be configured to setup this mode.
The delegate_DataLoad must return a List<CLFormListData> which contains all the elments of the list.
The delegate_CellDoubleClick function is executed when the user double click on a cell of the selection windows.


TextAutoComplete
The autocomplete mode extend the default textbox autocomplete by validating the input over the list of items.
The list of items is AutoCompleteStringCollection type.

ComboBox
Double Clicking on the component make a combobox list opens, user must select an elements from this list.
A List<CLFormListData> must be declared to fill the combobox list.

RegEx
A RegEx expression must be defined in order to make this mode work.


Code is developed using Microsoft Windows Visual Studio 2010.
This components runs for .NET framework 3.5 or higher.
An example is provided for every mode listed.

Project Page


Notes
  • read risk disclaimer
  • excuse my bad english

No comments:

Post a Comment