VB中定长string类型在VB.NET中怎样改?
vb中如下定义:
Type USER_INF
control_sv_name As String * 16
exepath As String * 128
oraclehost As String * 16
oracleuid As String * 8
oraclepassword As String * 16
oracletbluid As String * 8
excel_reportpath As String * 128
Shortbcr_exePath As String * 128
Shortbcr_datapath As String * 128
longbcr_exepath As String * 128
longbcr_datapath As String * 128
End Type
我在vb.net中改成如下来用,是否可以
Structure USER_INF
Dim control_sv_name As String
Dim exepath As String
Dim oraclehost As String
Dim oracleuid As String
Dim oraclepassword As String
Dim oracletbluid As String
Dim excel_reportpath As String
Dim Shortbcr_exePath As String
Dim Shortbcr_datapath As String
Dim longbcr_exepath As String
Dim longbcr_datapath As String
End Structure
上面的使用可行吗?先谢谢大家帮忙啦
[解决办法]
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> _
Dim control_sv_name As String
[解决办法]
参考下面的帖子
http://community.csdn.net/Expert/topic/5376/5376725.xml?temp=1.200503E-02
[解决办法]
Structure USER_INF
Dim control_sv_name As String
Dim exepath As String
Dim oraclehost As String
Dim oracleuid As String
Dim oraclepassword As String
Dim oracletbluid As String
Dim excel_reportpath As String
Dim Shortbcr_exePath As String
Dim Shortbcr_datapath As String
Dim longbcr_exepath As String
Dim longbcr_datapath As String
End Structure
dim obj1 as USER_INF
with obj1
.control_sv_name=space*16
.exepath=space*128
end with
其它类同