Monday, November 26, 2012
C# - Text Boxes and User-Friendly Techniques
by: Your Instructor - Mike
Hi all!
Today we work in Lesson 03. Here you will learn about a critical control, the text box. This control is used to get input data from the user. There are a number of features of this control that you really need to learn about. Also, there are some things you can do to make using this control much easier for your users.
Mike
11/21/2012 4:06:28 AM
by: Richard
private void btnCalculate_Click(object sender, EventArgs e)
{
String name = txtName.Text;
double sales = Convert.ToDouble(txtSales.Text);
double commission = sales * .02;
MessageBox.Show(String.Format("Your commission is {0:C}.", commission),
name + "'s Commission",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
Properties > Design > (Name) > txtSales = Text Box (with no text)
Properties> Design > (Name) > lblSales = Sales (label)
I got the label and text box mixed up when debugging.
It took me an hour to find out what went wrong. ...
Make sure that your Label corresponds to your label name, lblName. Then, make sure you Text box (with no text) corresponds to your text name txtName, in the properties window. It works fine now, thanks very happy it works now. I accidentally switched the two.
11/26/2012 12:04:17 AM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment