I'm trying to create a program that will simulate a dog race. and 3 players are able to bet on any of the dogs, but they can only bet up to $15 each. I have all of this set up except for only allowing up to $15 to be bet. the code is extremely long so I'll try to explain what I have so far
So I have radio buttons to select which player want to place their bet, once a player is selected, 4 radio buttons are enabled which allows the player betting to choose which dog they want to bet on. after a dog is chosen I have a textbox named txtAmount which they then enter an amount they'd like to bet. they then press a button named btnBet which confirms their bet and allows another player to bet.
my question is this: is it possible to allow the numbers entered into the textbox to only go up to 15? (I already have it so that only numbers can be enter, but I want to restrict what number it can go up to), or would it be better to just put in a ComboBox??
UPDATE
here is the code I used to restrict the textbox to numbers only:
private void txtAmount_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != '\b')
{
e.Handled = !char.IsNumber(e.KeyChar);
}
}
my question is not a duplicate to the other question mentioned in the comment. here's why: I'm not asking how to restrict to just numbers, I'm asking how to restrict to certain numbers (1-15 inclusive)