4
Answers

Adding validation to text box control

Ranjit Menon

Ranjit Menon

10y
762
1
I have a text box and button in as seen in the code below. I need to apply validation such that 

tT       The user should not be able to click the button if the user has entered an invalid quantity (i.e. non integer or less than zero).



<Label Grid.Row="5" Grid.Column="0">Quantity:</Label>
                    <TextBox Name="txtQuantity" Grid.Row="5" Margin="7,0,0,0" Grid.Column="1" HorizontalAlignment="Left" Width="33" />
                <Button Name="btnEdit" Content="Edit" Grid.Column="2" HorizontalAlignment="Left" Margin="14,0,0,3" Grid.Row="5" Width="46" RenderTransformOrigin="-0.027,0.5" Height="20" VerticalAlignment="Bottom" Click="btnEdit_Click"/>
Answers (4)