//ensure username is only a number or alphabetic letter, with at least 3 characters public bool ValidateUsername(string username) { bool valid = false; Regex reg = new Regex(@"^[a-zA-Z0-9]*$"); string phrase = TextBoxStyle.CheckWhichTextBox("username"); if (reg.IsMatch(username) && username != phrase && username.Length >= 3) { valid = true; } return(valid); }