MaxLength is the constant that you should compare against. I think the comparison would be textBox1.TextLength > textBox1.MaxLength, but I tried it a few times and it looks like you don't need to do anything because once you're at the MaxLength it won't let you add anything more into the textbox anyway.
I assume you are putting the code in the textboxes TextChanged event.
You are checking if the max length of the textbox is less than 10.
What you need to do is check if the length of the text entered is greater than the max length:
if (txtCustName.Text.Length > txtCustName.MaxLength)
MessageBox.Show("Max characters reached");
Jonsca is right of course. If you wanted to show the messagebox to inform the user when they reached the max just change the comparison to txtCustName.Text.Length == txtCustName.MaxLength. That way the messagebox will show when they enter the last character.
You could also put the above code into the textboxes KeyPress event. That way if they tried to enter a character after the max was reached it would show the message so they knew why nothing appeared in the textbox.
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...