[求助]vb.net 里这个错误是怎么回事啊?
www.dimcax.com
[求助]vb.net 里这个错误是怎么回事啊?
vb.net中的object reference not set to an instance of an object
错误,代码如下:
imports system.runtime.interopservices
<structlayout(layoutkind.sequential)> structure pt_diowritebit
......
end structure
private lpdiowriteport as pt_diowriteportbyte
declare function drv_diowritebit lib "adsapi32.dll"
(byval driverhandle as integer,byref diowritebit as pt_diowritebit) as
integer
dim ptdiowritebit as new pt_diowritebit
ptdiowritebit.port = 0
ptdiowritebit.bit = 1
ptdiowritebit.state = 1
dim newclass1 as new class1
errcde = newclass1.drv_diowritebit(devicehandle, ptdiowritebit)
errcde为整型
到这里调用函数drv_diowritebit时,出现该错误。
object reference not set to an instance of an object
请教各位大虾,这是为什么啊?
在vb中的类似代码是没问题的。