Enable/Disable a Commandbutton Based on Maxlength Using Change Events
Category:Forms and Controls
Version Compatibility: Visual Basic 6
Use the change event, the Maxlength property and Len/Trim functions to enable a CommandButton based on a given number. This example requires a command button control and two textbox controls. If the length of textbox 1 is less than or greater than the number supplied in textbox 2, the command button is disabled.
Instructions: Copy the declarations and code below and paste directly into your VB project.