lundi 28 octobre 2019

If statement to require a number input into textbox

I am creating a GUI in Visual Studio (C#) and need help creating an if statement that requires the user to input an integer- no doubles or letters.

Once the wrong information is entered it should prompt the MessageBox

I have tried searching online for a solution but cant seem to find an answer that fits my situation.

    {
        int DonationID = 100;
        if (DonationID < 101)
            MessageBox.Show("Please enter a number above 100!");
    }

Right now the code compiles, just not for the requirements I want and it does not prompt the message box and I do not know why.

Aucun commentaire:

Enregistrer un commentaire