I found a cool custom Currency Textbox control on this site. http://www.vbdotnetheaven.com/UploadFile/scottlysle/CurrencyControl_VB03242007121927PM/CurrencyControl_VB.aspx
The only issue that I have is it uses the base class Textbox MaxLength property - default textbox. In the applications we are using, we would never have a Currency value greater than 1000000.00. My current workaround is to set the MaxLength property of this custom control to 10.
I was wondering if there is a way to Override the MaxLength property for this custom control so that it does NOT allow a value greater than 10. I expect that this would need to be checked at design time - not runtime.
I have no idea how to go about this and appreciate any suggestions.
John WoodPosted May 28, 2009, 10:38 AM
You can make your own class control that inherits that control, or just get the source, and use the Override attribute for the class and define your own length. I would suggest getting the source, myself, and seeing how you can edit the control method/properties to obtain the length you want.
Also, most text boxes use the format: to define the format. There are some that use maxlength as the total string length of the value but that is not good process. By using the : format you can expand in both directions without having to calculate the sum total of the string and you use the decimal (".") character as your benchmark to go to the left or right of the 0 point.