Here is what I was working on:
Create a GUI application that allows the user to enter
an hourly pay rate in a TextBox. When the user clicks
a button and the value in the TextBox is less than
$7.50, display an error message
This is my source code:
double payrate;
double actualyPayRate = 7.5;
payrate = Convert.ToDouble(inputTextBox.Text);
if (payrate < actualyPayRate)
displayLabel.Text = "Illegal pay rate!";
else
displayLabel.Text = "Thank you!";
I am curious if there is another way to do the same work, any suggestions?
Loading
Sam HobbsPosted Dec 15, 2011, 8:25 PM
When you are more experienced with C#, you can develop a class derived from TextBox that ensures valid data interactively as the user types each key. As a beginner, you can use the MaskedTextBox Class to do that.
Prime bPosted Dec 15, 2011, 7:12 PM
VulpesPosted Dec 15, 2011, 4:16 PM