Reputation: 93
So i want to be able to prevent people increasing the number in a numericupdown after an assigned point is met.
e.g. in rugby the amount of conversions cant be larger then the amount of tries. so say i assigned one numericupdown as tries and had it at 4 then another as conversions. how do i limit so people cant put in anymore then 4 tries.
At the moment i have have NumericUpDowncon.Maximum = try
but it still allows the user to input more conversions then tries but then when the calculate button is pressed it puts the converions back down to the max it could be in reguards to the tries.
Upvotes: 0
Views: 153
Reputation: 2333
Assign a handler to the ValueChanged event of both NumericUpDowns. In the handler you'll have to check if conversions > tries.
Private Sub NumericUpDowncon_ValueChanged(sender as Object, e as EventArgs) _
Handles NumericUpDowncon.ValueChanged, NumericUpDowntry.ValueChanged
If NumericUpDowncon.Value > NumericUpDowntry.Value then NumericUpDowncon.Value = NumericUpDowntry.Value
End Sub
Upvotes: 1