1
I’m doing a shopping program and found on this same site. The answer to a problem I had but did not understand what would be the part (Char)0, among others. I need an explanation of what this is.
private void preVenda_KeyPress(object sender, KeyPressEventArgs e)
{
    if ((e.KeyChar < '0' || e.KeyChar > '9') && 
         e.KeyChar != ',' && e.KeyChar != '.' && 
         e.KeyChar != (char)13 && e.KeyChar != (char)8)
    {
        e.KeyChar = (char)0;
    }
    else
    {
        if (e.KeyChar == '.' || e.KeyChar == ',')
        {
            if (!preVenda.Text.Contains(','))
            {
                e.KeyChar = ',';
            }
            else
            {
                e.KeyChar = (char)0;
            }
        }
    }
}
Follow the image:
