求助:创建了位图文件并指定路径,但无法获得其宽度?
原程序是这样:
Imports System.Data.SqlClient
Imports System.data
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Security.Cryptography
Imports System.io
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim temp As Bitmap
temp.FromFile( "C:\Inetpub\wwwroot\test\1.bmp ")
label1.text=temp.width
end sub
运行后提示:未将对象引用设置到对象的实例
有人说需要先判断是否为空值,我改过后运行是没问题了,但点击按钮后label.text显示的还是空
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim temp As Bitmap
if not temp is nothing then
temp.FromFile( "C:\Inetpub\wwwroot\test\1.bmp ")
label1.text=temp.width
end if
end sub
大家再看看,还可能是哪的问题
[解决办法]
temp.FromFile( "C:\Inetpub\wwwroot\test\1.bmp ")
if not temp is nothing then
label1.text=temp.width
end if
创建了位图文件并指定路径,但无法获得其宽度
求助:创建了位图文件并指定路径,但无法获得其宽度?原程序是这样:ImportsSystem.Data.SqlClientImportsSyst
