Max amount letters in textbox

Is there a way to get this to work without using OnTextChanged?