[求助]vb.net 里这个错误是怎么回事啊?
<P> vb.net中的object reference not set to an instance of an object</P><P>错误,代码如下:</P>
<P>imports System.Runtime.InteropServices<BR> <StructLayout(LayoutKind.sequential)> structure PT_DioWriteBit<BR> ......<BR> end structure</P>
<P> private lpDioWritePort As PT_DioWritePortByte</P>
<P> Declare Function DRV_DioWriteBit Lib "adsapi32.dll"<BR> (ByVal DriverHandle As integer,byref DioWriteBit As PT_DioWriteBit) As<BR> integer</P>
<P> Dim ptDioWriteBit As New PT_DioWriteBit<BR> ptDioWriteBit.Port = 0<BR> ptDioWriteBit.bit = 1<BR> ptDioWriteBit.state = 1</P>
<P> Dim newClass1 As New class1<BR> errCde = newClass1.DRV_DioWriteBit(deviceHandle, ptDioWriteBit)</P>
<P>errCde为整型</P>
<P>到这里调用函数DRV_DioWriteBit时,出现该错误。</P>
<P> object reference not set to an instance of an object</P>
<P>请教各位大虾,这是为什么啊?</P>
<P>在vb中的类似代码是没问题的。</P>
页:
[1]