Try:
private const string NotAllowed = @"><@{}[]#&()/|*-+$%~\";
private void textbox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (NotAllowed.Contains(e.KeyChar))
{
e.Handled = true;
}
}
Or even:
private const string NotAllowed = @"><@{}[]#&()/|*-+$%~\";
private void textbox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = NotAllowed.Contains(e.KeyChar);
}