在VB.NET里定义数据结构(其中含有数组)

lpmko6 2010-03-26 09:01:15
怎么将以下代码转变为vb.net

typedef struct gdat_KPDAT
{
char Code[8];
float Yclose;
float Open;
float High;
float Low;
float Close;
DWORD Volume;
DWORD Inside;
DWORD Outside;
float Amount;
float Buyp[5];
DWORD Buyv[5];
float Sellp[5];
DWORD Sellv[5];
}GKPDAT,*LPGKPDAT;
...全文
152 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xingyuebuyu 2010-03-26
  • 打赏
  • 举报
回复
       Public Structure gdat_KPDAT
<System.Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=8)> _
Public code() As Byte
Public Yclose As Single
Public Open As Single
Public High As Single
Public Low As Single
Public Close As Single
Public Volume As UInteger
Public Inside As UInteger
Public Outside As UInteger
Public Amount As Single
<System.Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=5)> _
Public Buyp() As Single
<System.Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=5)> _
Public Buyv() As UInteger
<System.Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=5)> _
Public Sellp() As Single
<System.Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=5)> _
Public Sellv() As UInteger
End Structure
lsh2216024 2010-03-26
  • 打赏
  • 举报
回复
char Code[8];
变为
public Code(8) as string
学习到老死 2010-03-26
  • 打赏
  • 举报
回复

Public Structure gdat_KPDAT
‘中间需要注意类型转换
’如code
public code as string
‘这里用string可以兼容char,其他数值型的也差不多,一般比它范围大的都兼容
end Structure

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧