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?
Well, you aren't entirely true. Not ready - correct, but it is much better than you claim. My buddy whos not a techie and not married to elon or tesla has gotten FSD trials a few times since owning his Y and his biggest complaint is that the FSD isn't aggressive enough to compete with Houston texas drivers and that makes him feel like he might get into a wreck where I argued less agressive and more cautious is a good thing.
I think we are around 10 years away from it being a common thing like flying. Waymo by Google is really good. Tesla likely isnt far behind and has more data they are feeding their AI because it comes off every tesla owned and driven and connected to the owners home wifi network.
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