#2
梦幻倩影2016-10-29 10:18
|
程序关键部分简化如下:
Public Class Form1
Dim a As PictureBox = PictureBox1
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
a.Image = Image.FromFile(Application.StartupPath & "\1.jpg")
End Sub
End Class
结果显示“未将对象引用设置到对象的实例”,图片不能导入。
为什么会出现这种情况?
如何解决?(保留全局变量的声明)