如何添加所有文本框然后将其转换为10%的结果? [英] How to add all the textboxes then convert it to 10% result?

查看:64
本文介绍了如何添加所有文本框然后将其转换为10%的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果添加所有文本框然后将其转换为10%,你可以帮助我吗?



这里是我的文本框,最大输入是每个20个



我尝试过:



btncalculate

Hi can anyone help me if add all the textboxes then convert it to 10%?

here's my textboxes the max input is 20 each of them

What I have tried:

btncalculate

txtQuiz1.text
txtQuiz2.text
txtQuiz3.text
txtQuiz4.text
txtQuiz5.text
txtQuiz6.text
txtResultQuiz.text

推荐答案

只需添加那些文本框值并除以总计(120)?我之前误解了这个问题,OP请求VB.NET而不是C#和10%的结果



Just add those textbox value and divide by the total (120) ? I misread the question earlier, the OP requested VB.NET instead of C# and 10% of the result

txtResultQuiz.Text = (CDbl(Integer.Parse(txtQuiz1.Text) _
+ Integer.Parse(txtQuiz2.Text) _
+ Integer.Parse(txtQuiz3.Text) _
+ Integer.Parse(txtQuiz4.Text) _
+ Integer.Parse(txtQuiz5.Text) _
+ Integer.Parse(txtQuiz6.Text)) * 0.1).ToString()




txtResultQuiz.Text =
               ((double) (int.Parse(txtQuiz1.Text) + int.Parse(txtQuiz2.Text) + int.Parse(txtQuiz3.Text) + int.Parse(txtQuiz4.Text)
                + int.Parse(txtQuiz5.Text) + int.Parse(txtQuiz6.Text)) / 120).ToString("0.00%");


这篇关于如何添加所有文本框然后将其转换为10%的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆