I have a textbox where i dont want numbers to be typed.I have a code for it but when the user types only letters and goes to a new line and saves it wont allow to save.How can i fix this?

Match matchFullNameRegex = Regex.Match(fullNameTextBox.Text, "^[a-zA-Z ]*$");

        if (!matchFullNameRegex.Success)
            MessageBox.Show("Please insert only letters in FullName.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            isValid = false;

In what event is the code you posted?
How is isValid used?
Did you consider blocking all but number keys using the KeyDown event?

Be a part of the DaniWeb community

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