从其他过程调用全局标签数组

时间:2016-07-29 18:39:15

标签: vb.net

以下程序以前已经奏效,但根本没有工作:

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

Dim Labels() As Label = New Label() {Label1, Label2, Label3}

end sub

Private Sub Labels_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles Label1.Click, Label2.Click, label3.Click

    for i = 0 to 2
        Labels(i).BackgroundImage = My.Resources.buttonBselected 'NOT WORKING!!!
    next
end sub

它变成" NullReferenceException"信息。 如何声明标签数组全局等? (VS 2010)

0 个答案:

没有答案