将所有要加载的号码添加到下拉列表中 [英] Adding all numbers being loaded in a dropdownlist

查看:62
本文介绍了将所有要加载的号码添加到下拉列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表框,它使用数据库表中的数字加载自身.现在,我想将下拉列表中出现的所有数字加起来.有人可以提示如何添加所有这些数字吗?

I have a list box that loads itself with numbers from the database table. Now I want to add up all the numbers being present in that drop down list. Can anyone give a hint how to add all those numbers?

推荐答案

可以!
1.在列表框的各个项目上进行for循环
2.在每次迭代中,获取该索引/项目的特定值
3.在变量中跟踪这些值.保持汇总计数器"
4.循环结束后,使用总和计数器显示值(所有现有数字的总和.)
Sure!
1. Right a for loop across the items of the listbox
2. In each iteration, get the specific value for that index/item
3. Keep a track of those values in a variable. Keep a ''summ counter''
4. Once the loop is over, use the sum counter to show the value (add up of all existing numbers.)


这篇关于将所有要加载的号码添加到下拉列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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