我是这样写的:[DllImport("C:\\Dcic32.dll")]
private static extern int IC_Read(int ICDev,int offset,int len,ref byte[] b);
private void button2_Click(object sender, System.EventArgs e)
{
byte[] bb =new byte[8];
IC_Read(i,0,8,ref bb);
}
但还是不行,系统报错:
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication1.exe 中。
其他信息: 未将对象引用设置到对象的实例。
private static extern int IC_Read(int ICDev,int offset,int len,ref byte[] b);
private void button2_Click(object sender, System.EventArgs e)
{
byte[] bb =new byte[8];
IC_Read(i,0,8,ref bb);
}
但还是不行,系统报错:
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication1.exe 中。
其他信息: 未将对象引用设置到对象的实例。
解决方案 »
- [treeview]中选择节点前的checkbox无刷新问题
- 程序集“D:\项目\FolderTree\FolderTree\obj\Debug\FolderTree.dll”不包含任何 UserControl 类型
- 关于 C#工程的 .exe 的显示图标的问题
- 关于mssql2005Express的问题!
- 请问:哪个仁兄,能给我个当数据多时,能出现滚动条,不需分页的datagrid的例子(B/S,C#)?
- 刚学存储过程,请看下这个存储过程那里有错
- 请问C#如何使用com+组件
- .net流里面有没有这种事件?
- 高分求解!!!!!!!!乱码问题急急急
- c++和c#中的switch的区别怎么解决
- 求正则表达式问题!!
- 怎样把资源文件和软件合成到一起制成"嵌入式"?(最后20分不够再加)
private static extern int IC_Read(int ICDev,int offset,int len, byte[] b);
不要用 ref 。
byte[] b = new byte[len];
IC_Read(...., len, b);StringBuilder also works:
StringBuilder sb = new StringBuilder(len);
IC_Read(..., len, sb);
string s = new string('\u0000',9);
IC_Read (i, 0, 8, ref s);try ref all when after error