Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > Component Development

Component Development Development of components with VB.NET

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-27-2008, 3:52 PM
newguy's Avatar
VB.NET Forum Idol
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2008
Location: Denver Co, USA
Posts: 547
Reputation: 128
newguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET star
Default MaxLength problem in user control.

Ok I have a textbox on a user control, and I set the MaxLength property to 3, but it does not stop at 3 when the program is running. These controls are added at runtime and I have even added the maxLength property in code when building the control. Any ideas?
__________________
Close Counts for Horseshoes, Handgranades, and Nuclear Missiles!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-01-2008, 7:32 PM
newguy's Avatar
VB.NET Forum Idol
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jun 2008
Location: Denver Co, USA
Posts: 547
Reputation: 128
newguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET starnewguy a shining VB.NET star
Default

Appearently btn_click events that add text override the MaxLength property.
So check the text.length in the click event before adding the text...
__________________
Close Counts for Horseshoes, Handgranades, and Nuclear Missiles!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-02-2008, 7:01 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,325
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

You had to find out emperically now, but next time you check the help documentation, which in this case in very clear about your inquiry, for example if you press F1 on MaxLength property in designer or code.
Quote:
Gets or sets the maximum number of characters the user can type or paste into the text box control.
With even more explicit info in Note:
Quote:
In code, you can set the value of the Text property to a value that has a length greater than the value specified by the MaxLength property. This property only affects text entered into the control at run time.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 5:56 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.