Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello codeproject.
i need help to solve my problem.
assumming i have textbox1.text that every 5 second receive string that contain 100 char.
but how to make my char only can contains char less than five char? how to auto delete 95 rest char? i was used maxlength but still not working the textbox still receive 100 char.
Posted

1 solution

The MaxLength property only applies when text is typed into the TextBox.

As you are adding the text programmatically you will need to truncate the text yourself

For example
VB
Dim s As String = "1234567946544"
        Me.TextBox1.Text = s.Substring(0, 4)
 
Share this answer
 
Comments
Gun Gun Febrianza 16-Nov-13 11:31am    
thx for help, i will try the code. iwill report soon :)
Gun Gun Febrianza 16-Nov-13 11:32am    
ahhh thiss is what i need !! thank you love you sir muaccccccccccch !! hahah

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900