Reputation: 45
is there a way for the maximum value of numericUpDown linked or depends on the value of textbox labeled AB?
for example the value of textbox labeled "AB" is 10, it automatically sets the maximum value of numericUpDown to 10.
Upvotes: 0
Views: 653
Reputation: 216303
You can simply add an event handler for the Leave event and set the Maximum property of the NumericUpDown in that event
Sub AB_Leave(sender As Object, e As EventArgs)
Dim value As Decimal
' Safety check, the user can type anything in the textbox,
' we accept only a decimal number
If Decimal.TryParse(AB.Text, value) Then
numericUpDown1.Maximum = value
End If
End Sub
Upvotes: 1