I need to be able to count the textbox characters on a keypress, how would I do that?

You could use textbox.Text.Lenght. If you have a multiline textbox, use the Lines property wich return an array of strings.

You could use textbox.Text.Lenght. If you have a multiline textbox, use the Lines property wich return an array of strings.

If you have a multi-line textbox, use

length = textBox1.Text.Replace(Environment.NewLine, "").Length;

So like this? if (txtUser.Text.Length.ToString() == "4")

Could be but it's a bit overkill.
Better use: if (txtUser.Text.Length == 4)

If were going to make it so another is enabled after 4 character would I use

if (txtUser.Text.Length == 4<20)

Not completely sure what you're after but if you want to check if it's between 4 and 20 you could use:

if (txtUser.Text.Length >= 4 && txtUser.Text.Length < 20)
            {

            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.