对于复选框中的每个循环 [英] for each loop in a checkbox

查看:103
本文介绍了对于复选框中的每个循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有六个复选框,所以我去看看它们和os它们都被检查了如果是这样

加50总额

继承我的代码


Dim arrchecks(6)作为CheckBox

arrchecks(0)= Me.chkChicken

arrchecks(1)= Me.chkMushrooms

arrchecks(2)= Me.chkPepperoni

arrchecks(3)= Me.chkECheese

arrchecks(4)= Me.chkHam

arrchecks(5)= Me.chkPeppers


每个chk作为CheckBox在arrchecks

chk.CheckState = CheckState.Checked

总计= +50


下一个chk

我知道我做错了什么

谢谢

I have six checkboxes so I went to see it and os them are checked and if so
add 50 to the total
heres my code

Dim arrchecks(6) As CheckBox
arrchecks(0) = Me.chkChicken
arrchecks(1) = Me.chkMushrooms
arrchecks(2) = Me.chkPepperoni
arrchecks(3) = Me.chkECheese
arrchecks(4) = Me.chkHam
arrchecks(5) = Me.chkPeppers

For Each chk As CheckBox In arrchecks
chk.CheckState = CheckState.Checked
total = +50

Next chk
I know I am doing something wrong
Thanks

推荐答案



" freddy" < FR **** @ discussions.microsoft.com>写了

"freddy" <fr****@discussions.microsoft.com> wrote
如果是这样的话,在
中为每个chk添加50作为CheckBox在arrchecks中
chk.CheckState = CheckState.Checked
total = + 50
下一个chk
我知道我做错了什么
and if so add 50 to the total For Each chk As CheckBox In arrchecks
chk.CheckState = CheckState.Checked
total = +50
Next chk I know I am doing something wrong



你的If语句在哪里?


LFS


Where is your If statement?

LFS


我没有if语句,但我确实需要一个吗?


" Larry Serflaten"写道:
I have no if statement, but I do need one right?

"Larry Serflaten" wrote:

freddy < FR **** @ discussions.microsoft.com>写了

"freddy" <fr****@discussions.microsoft.com> wrote
如果有的话,在总数中添加50
and if so add 50 to the total


For each chk As checkBox in arrchecks
chk。 CheckState = CheckState.Checked
total = +50
下一个chk
For Each chk As CheckBox In arrchecks
chk.CheckState = CheckState.Checked
total = +50
Next chk


我知道我做错了什么



你的If声明在哪里?

LFS


Where is your If statement?

LFS





" freddy" < FR **** @ discussions.microsoft.com>写了

"freddy" <fr****@discussions.microsoft.com> wrote
我没有if语句,但我确实需要一个吗?
I have no if statement, but I do need one right?




多数民众赞同你所说的,就在这里:



Thats what you said, right here:

如果有的话,将50加到总数中
and if so add 50 to the total



自添加50是有条件的,你需要使用条件

命令。在这种情况下,这将是If语句....

你的If语句在哪里?


Since adding 50 is conditional, you need to use the conditional
commands. In this case that is going to be the If statement....
Where is your If statement?




LFS



LFS


这篇关于对于复选框中的每个循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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