[.NET] 關於VB2005全域變數看不大懂
Dim rate As Single = 0.05
Dim amout As Integer
Dim total As Single = 0
Sub show()
If CheckBox1.Checked Then
total += 5500 * TextBox1.Text
End If
If CheckBox2.Checked Then
total += 3500 * TextBox2.Text
End If
total += total * rate
TextBox3.Text = total
Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles RadioButton1.CheckedChanged,
RadioButton2.CheckedChanged
If RadioButton1.Checked Then
rate = 0.05
Else
rate = 0.1
End If
show()
End Sub我想問大大們
Dim total As Single = 0
如果宣告在sub show()這格副程式裡面...跟宣告在全域變數有什麼差??
執行局果不ㄧ樣
那如果是rate呢
如果宣告在副程式裡會有什麼差嗎
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.166.73.185
→
01/08 15:10, , 1F
01/08 15:10, 1F
→
01/08 21:31, , 2F
01/08 21:31, 2F
→
01/08 21:32, , 3F
01/08 21:32, 3F
→
01/08 21:32, , 4F
01/08 21:32, 4F