[.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