是否可以将列表框中的所选项目与所有项目分开? [英] Any possible way of dividing selected items in a listbox with all items?

查看:59
本文介绍了是否可以将列表框中的所选项目与所有项目分开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家好!我有一个关于列表框的问题..是否可以将列表框中的所选项目与列表框中的所有项目分开?假设我有10个项目,其中2个被选中,我能以某种方式划分2/10吗?如果是这样,我怎么能这样做?

解决方案

你有什么问题?



想象出ListBox中有多少项似乎非常容易。找到所选项目的数量也很容易。现在,你有没有问题让代码将2除以10?尝试将获得这些计数的整数转换为 double 甚至小数,在您尝试划分它们之前,取决于您的要求。另外,请确保您将结果分配给的变量属于同一类型。


Hey everyone! I got a question about a listbox.. Is it possible to divide selected items in the listbox with all of the items in the listbox? Let's say I have 10 items and 2 of them are selected, can I in some way divide 2/10? if so, how can I do this?

解决方案

What part of this are you having a problem with?

It seems incredibly easy to figure out how many items are in the ListBox. It's also very easy to find the number of items Selected. Now, are you having problems getting code to divide 2 by 10? Try converting the integers you got from getting those counts to single, double or even decimals, depending on your requirements, before you try to divide them. Also, make sure the variable you're assigning the result to is of the same type.


这篇关于是否可以将列表框中的所选项目与所有项目分开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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