Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble setting a User Control Properties.

Status
Not open for further replies.

VB4Life

Programmer
Nov 8, 2008
50
US
In my user control I have a textbox, and I am unable set the MaxLength property at design or runtime, also I have multiple controls that add this control and pull the .text from this textbox each needing to have a diff. MaxLength number, I already have the code for the calling control to get the .text info. Just need to know if I can somehow set this property? Thanks Experts...
 
What do you mean you are unable to set it? You can't access the property from your code or see it in the properties pane? Or are you saying that it just doesn't work when you set it?
 
That is correct, when I set the property to 3 it is ignored when the program is running.
 
I don't have any problems with that functionality, and nothing comes to mind as to what it could be. You'd have to post some code for the user control and how you're setting the property.
 
In the click event for the textbox this is my code:

nkp = New NumberKeyPadCTR
nkp.Location = New System.Drawing.Point(262, 45)
nkp.txtKeyPad.MaxLength = 3
flpUC.Visible = True
flpUC.Controls.Add(nkp)
flpUC.BringToFront()
nkp.DestinationBox = wtbox
this is not working for setting the MaxLength property,
I also set the MaxLength property in the property window, it is just not working, weird...
 
Appearently a btn_click event that adds text to a textbox overrides the MaxLength property!

Crisis overted, just have to work around this, thanks RiverGuy for looking...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top