Saturday, June 29, 2013

Limit the characters in a TextBox

Well, my question is very simple. Only one line code can do it.



TextBox.MaxLength = 10

But this only works when you are typing. Imagine the next case:



Dim s as string = "I.Need.Help.MSDN"
'16 characters'

TextBox.MaxLength = 10
TextBox.Text = s

'Final result in TextBox: I.Need.Help.MSDN that is higher than 10 characters'

So, what I want to do, is remove all characters up to my MaxLenght Value (10)


Is it possible?


(I´m using .Net Framework 3.5 in Visual Studio 2012)




Meu novo programa (Bloco de Notas) http://hyrokumata-app.blogspot.pt/2012/07/notepad-3-beta.html


No comments:

Post a Comment