I have 3 text boxes 1TB,2TB and 3TB. I would like to multiply 1TB by 2TB and put the answer in 3TB. Can anyone help me with this code. Im new to C# and I keep getting errors.
Thanks in advance.
MJV
0
Junior Poster in Training
Recommended Answers
Jump to Post1TB,2TB and 3TB... ???
rite version...
TB1,TB2 and TB3
Jump to PostInt32 res=Int32.Parse(textBox1.Text); res=res*Int32.Parse(textBox2.Text); textBox3.Text=res.ToString();
Jump to PostFor school work that is fine. For real world, you should use Int32.TryParse because you never know what will be in those text boxes.
int result_1; int result_2; if (Int32.TryParse(textBox1.Text, out result_1) && Int32.TryParse(textBox2.Text, out result_2)) { textBox3.Text = (result_1 * result_2).ToString(); }
All 9 Replies
cikara21
37
Posting Whiz
MJV
0
Junior Poster in Training
cikara21
37
Posting Whiz
JerryShaw
46
Posting Pro in Training
MJV
0
Junior Poster in Training
cikara21
37
Posting Whiz
ddanbe
2,724
Professional Procrastinator
Featured Poster
MJV
0
Junior Poster in Training
ddanbe
2,724
Professional Procrastinator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.