Jun 10th, 2003, 12:48 AM
VB .NET Edit control Replacement (TextBox)
Here is some code to create a replacement of the standard Edit control in VB .NET. I've added some properties, that could be useful. Besides that, it could be a good way to show you how to create a user control on your own in VB .NET.
-MinLength: Minimum length that the textbox must contain.
-AcceptedType: Any, Rounded numbers or Broken numbers.
-AcceptNumbersOnly: Only accept numbers from 0 to 9
-ErrorControl: If an error occurs, for example when you set AcceptedType to Rounded number, and you enter a broken number, the error message will be shown in this control.
-ErrorControlForeColor: The forecolor of the error message in the error control.
-ErrorKeyPress: Check for error in control on KeyPress event, or (internally) on the OnValidating event.
-ErrorMessageShow: If set to true, the error message will be shown in a messagebox when the ErrorControl property is not set.
-ErrorShowTooltip: Show the error message in the tooltip
-ErrorTBBackColor: BackColor of the Edit control when an error occurs.
ErrorTBForeColor: ForeColor of the Edit control when an error occurs.
-BackColorNormal and ForeColorNormal: replacements of the standard BackColor and ForeColor properties.
-IsRequired: Is this Edit control required to fill
-BackColorRequired: The backcolor of a required control.
-CanBeEmpty: Sometimes when a value is required, you want to allow an empty string. That is possible when this property is set to true (Maybe I should remove this property...)
-ErrorValidate: Here you can edit the ErrorMessage, and set the Validated variable to true or false.
Pick the code, and enjoy. Please report some bugs in here.
Click Here to Expand Forum to Full Width