I have an application with 20 textboxes, i need to do the calculations for example ((TextBox12 * TextBox1 * TextBox7) / 2) and display the result on label when clicking a button.
Ive usually done these like this:
private void lBtn_Click(object sender, EventArgs e) { double L, L2; if (double.TryParse(kTb1.Text, out L) && double.TryParse(kTb2.Text, out L2)) lBl4.Text = String.Format("{0:f1}", (L2 * L)); else MessageBox.Show("WTF?"); } [/CODE]
I was wondering if there is better way to do this so that I don't have to add all 20 textboxes into this with && double.TryParse?
The comment about clock speeds not changing is actually not really true. Due to aggressive power management, clock speeds on an idle system are lower now than they have been in decades. It isn't uncommon for a laptop to be hovering right around 1GHz if it isn't working on anything. Yes you right that more work gets done with each cycle, but you are still dealing with a nearly 5x difference between low and high power states, which can change how snappy the interface feels.
I totally agree with you about the action center and other Windows UI elements taking a shameful amount of CPU cycles to do basic functions, but I see that as a separate conversation.
While I do agree with the "don't sweep that under the rug" concern, I also don't want to get into a debate about what things deserve a boost or not. In my opinion, boost all the things, get the full value from your CPU.
Keep in mind, we are talking about milliseconds of boosting, it isn't meaningfully going to change power consumption.
Question
Joni_78
Hi,
I have an application with 20 textboxes, i need to do the calculations for example ((TextBox12 * TextBox1 * TextBox7) / 2) and display the result on label when clicking a button.
Ive usually done these like this:
I was wondering if there is better way to do this so that I don't have to add all 20 textboxes into this with && double.TryParse?
Link to comment
https://www.neowin.net/forum/topic/1083591-c-calculating-textbox-values/Share on other sites
17 answers to this question
Recommended Posts