VB .NET Edit control Replacement (TextBox)-VBForums
Results 1 to 1 of 1

Thread: VB .NET Edit control Replacement (TextBox)

  1. #1

    Thread Starter
    Hyperactive Member JMvVliet's Avatar
    Join Date
    May 2001
    Location
    Papendrecht, Netherlands
    Posts
    310

    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.

    Added properties:
    -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...)

    New event:
    -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.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.