[.NET] 請問不同的sub裡面的值能夠讀的到嗎?
請問各位大大
我目前正在做一個考英文單字的程式
我現在有一個button7 裡面會記錄回答錯誤的選項(我是用矩陣a()as boolean來記錄)
那我在button3中 卻讀不到我button7中有回答錯的題目a()
請問我該打甚麼才能讓button3中可以讀的到button7的東西呢>_<?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.42.213.55
※ 文章網址: http://www.ptt.cc/bbs/Visual_Basic/M.1401817445.A.007.html
→
06/04 08:42, , 1F
06/04 08:42, 1F
→
06/04 09:45, , 2F
06/04 09:45, 2F
→
06/04 09:46, , 3F
06/04 09:46, 3F
→
06/04 09:47, , 4F
06/04 09:47, 4F
→
06/04 09:48, , 5F
06/04 09:48, 5F
→
06/04 09:49, , 6F
06/04 09:49, 6F
→
06/04 09:54, , 7F
06/04 09:54, 7F
→
06/04 10:00, , 8F
06/04 10:00, 8F
→
06/04 11:37, , 9F
06/04 11:37, 9F
→
06/04 11:41, , 10F
06/04 11:41, 10F
→
06/04 13:14, , 11F
06/04 13:14, 11F
→
06/04 13:15, , 12F
06/04 13:15, 12F
→
06/04 14:36, , 13F
06/04 14:36, 13F
Public Class Form1
Dim A(0 To 1000) As Boolean
Public Property DataSource As Object
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles
Button7.Click
Dim k, s As Integer
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
'AABCCBCAAB喔>_<
'0012212001
k = ComboBox1.SelectedIndex
If ComboBox2.SelectedIndex = 0 Then A(10 * k + 1) = True 'true
If ComboBox2.SelectedIndex = 1 Then A(10 * k + 1) = False
If ComboBox2.SelectedIndex = 2 Then A(10 * k + 1) = False
If ComboBox3.SelectedIndex = 0 Then A(10 * k + 2) = True 'true
If ComboBox3.SelectedIndex = 1 Then A(10 * k + 2) = False
If ComboBox3.SelectedIndex = 2 Then A(10 * k + 2) = False
If ComboBox4.SelectedIndex = 1 Then A(10 * k + 3) = True 'true
If ComboBox4.SelectedIndex = 0 Then A(10 * k + 3) = False
If ComboBox4.SelectedIndex = 2 Then A(10 * k + 3) = False
If ComboBox5.SelectedIndex = 2 Then A(10 * k + 4) = True 'true
If ComboBox5.SelectedIndex = 0 Then A(10 * k + 4) = False
If ComboBox5.SelectedIndex = 1 Then A(10 * k + 4) = False
If ComboBox6.SelectedIndex = 2 Then A(10 * k + 5) = True 'true
If ComboBox6.SelectedIndex = 0 Then A(10 * k + 5) = False
If ComboBox6.SelectedIndex = 1 Then A(10 * k + 5) = False
If ComboBox7.SelectedIndex = 1 Then A(10 * k + 6) = True 'true
If ComboBox7.SelectedIndex = 0 Then A(10 * k + 6) = False
If ComboBox7.SelectedIndex = 2 Then A(10 * k + 6) = False
If ComboBox8.SelectedIndex = 2 Then A(10 * k + 7) = True 'true
If ComboBox8.SelectedIndex = 0 Then A(10 * k + 7) = False
If ComboBox8.SelectedIndex = 1 Then A(10 * k + 7) = False
If ComboBox9.SelectedIndex = 0 Then A(10 * k + 8) = True 'true
If ComboBox9.SelectedIndex = 1 Then A(10 * k + 8) = False
If ComboBox9.SelectedIndex = 2 Then A(10 * k + 8) = False
If ComboBox10.SelectedIndex = 0 Then A(10 * k + 9) = True 'true
If ComboBox10.SelectedIndex = 1 Then A(10 * k + 9) = False
If ComboBox10.SelectedIndex = 2 Then A(10 * k + 9) = False
If ComboBox11.SelectedIndex = 1 Then A(10 * k + 10) = True 'true
If ComboBox11.SelectedIndex = 0 Then A(10 * k + 10) = False
If ComboBox11.SelectedIndex = 2 Then A(10 * k + 10) = False
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
For i = 1 To 1000
If A(i) = True Then s = s + 1
Next
Label14.Text = "目前得分" & s & "/1000"
If s = 1000 Then
MsgBox("你好棒喔>_<")
Label13.Text = "達成目標了~好厲害喔~"
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
Dim x As Integer
'xxxxxx有無錯誤單字檢查xxxxxx
For i = 1 To 1000
If A(i) = 0 Then x = x + 1
If A(i) = True Then x = x + 1
Next i
If x = 1000 Then
MsgBox("你目前沒有錯誤單字喔")
Exit Sub
End If
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If A(1) = False Then Label1.Text = Label1.Text & vbCrLf & "1.a (an):一
個"
If A(2) = False Then Label1.Text = Label1.Text & vbCrLf & "2.a few:一
些"
Label1.Visible = True
Button1.Visible = False
Button2.Visible = False
Button3.Visible = False
Button8.Visible = True
End Sub
End Class
※ 編輯: dx0789111 (114.42.213.55), 06/04/2014 16:07:47
→
06/04 19:08, , 14F
06/04 19:08, 14F
推
06/08 23:19, , 15F
06/08 23:19, 15F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章