[.NET] 要怎样才能够累加值呢?

楼主: dx0789111 (神奇小红豆)   2014-05-27 17:17:23
请输入专案类型(网站专案或者应用程式专案):
visual studio 2013
我正在做一个背英文单字的程式
其中有一块是单字测验
在测验里面我是用combobox来选择选项
而选完之后就要按button来交
每一题答对会让总得分加一分
但是我弄出来他的得分都不会累加
只会跑出单次的分数
请问要怎么写才能让分数累加呢>_<
我的程式码
dim i as integer
select case combobox1.selectindex '日期
case 0
if combobox2.selectindex = 0 then i = i + 1
if combobox3.selectindex = 0 then i = i + 1
case 1
if combobox2.selectindex = 1 then i = i + 1
if combobox3.selectindex = 1 then i = i + 1
end select
label14.text = i
作者: johnpage (johnpage)   2014-05-27 20:51:00
key 全域变量
楼主: dx0789111 (神奇小红豆)   2014-05-27 22:55:00
抱歉 我真的看不太懂 请问是要怎么用key@@
作者: MOONRAKER (㊣牛鹤鳗毛人)   2014-05-28 12:14:00
每次都生一个新的i 当然不会累加你要把label14的内容先拿出来转换到i里面阿有一个字串转整数的函数 把label4.text转过去放到i里面
作者: nfsong (圖書館我來了)   2014-05-31 18:48:00
取label值 转integerlabel 值可用 e.item.itemtype=listitem.item and e.item.google 上面这句 取得control或者是form1.findcontrol 取得
作者: MOONRAKER (㊣牛鹤鳗毛人)   2014-05-31 23:17:00
路越绕越远了 快到北京了

Links booklink

Contact Us: admin [ a t ] ucptt.com