Click here to Skip to main content
15,912,932 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Resizing Columns in a DataGrid Pin
ami-uhle26-Sep-03 5:39
ami-uhle26-Sep-03 5:39 
GeneralAdding controls to a child control of a UserControl at design time Pin
jplocster19-Sep-03 22:15
jplocster19-Sep-03 22:15 
QuestionHow to Use API AddForm in VB.net Pin
allanli19-Sep-03 0:22
allanli19-Sep-03 0:22 
AnswerRe: How to Use API AddForm in VB.net Pin
NetPointerIN19-Sep-03 6:57
NetPointerIN19-Sep-03 6:57 
GeneralRe: How to Use API AddForm in VB.net Pin
allanli19-Sep-03 16:06
allanli19-Sep-03 16:06 
QuestionHELP! How to convert MS Word/Excel into Image? Pin
j.j18-Sep-03 23:24
j.j18-Sep-03 23:24 
AnswerRe: HELP! How to convert MS Word/Excel into Image? Pin
scott@otech.com23-Sep-03 4:17
scott@otech.com23-Sep-03 4:17 
QuestionMarshalling Data, Can Anyone Help? Pin
GrindAZ18-Sep-03 10:05
GrindAZ18-Sep-03 10:05 
I need to marshal a structure so that I can pass it to a C++ DLL and
vice versa. The following works correctly:

<structlayout(layoutkind.sequential)> _
Private Structure PLCDATA
<marshalas(unmanagedtype.i4)> Dim w1 As Int32
<marshalas(unmanagedtype.i4)> Dim w2 As Int32
<marshalas(unmanagedtype.i4)> Dim w3 As Int32
<marshalas(unmanagedtype.variantbool)> Dim b1 As Boolean
<marshalas(unmanagedtype.variantbool)> Dim b2 As Boolean
<marshalas(unmanagedtype.byvalarray, sizeconst:="5)"> Dim Arr() As Int32

Sub initialize()
ReDim Arr(4)
End Sub
End Structure


Now I need to have another item in the structure be an array of a
different structure. Hope that makes since. I thought this would
work but it gives me an error:

<structlayout(layoutkind.sequential)> _
Private Structure PARCEL
<marshalas(unmanagedtype.i4)> Dim Induct As Int32
<marshalas(unmanagedtype.i4)> Dim Dest As Int32
<marshalas(unmanagedtype.i4)> Dim Reason As Int32
End Structure

<structlayout(layoutkind.sequential)> _
Private Structure PLCDATA
<marshalas(unmanagedtype.i4)> Dim w1 As Int32
<marshalas(unmanagedtype.i4)> Dim w2 As Int32
<marshalas(unmanagedtype.i4)> Dim w3 As Int32
<marshalas(unmanagedtype.variantbool)> Dim b1 As Boolean
<marshalas(unmanagedtype.variantbool)> Dim b2 As Boolean
<marshalas(unmanagedtype.byvalarray, sizeconst:="5)"> Dim Arr() As Int32
<marshalas(unmanagedtype.byvalarray, arraysubtype:="UnmanagedType.Struct," sizeconst:="3)"> Dim Items() As PARCEL

Sub initialize()
ReDim Arr(4)
ReDim Items(2)
End Sub
End Structure

The error I get looks like this:

System.TypeLoadException: Can not marshal field Items of type PLCDATA:
This type can not be marshaled as a structure field.
at Test_PLCData.Form1.ReadFromPLC(PLCDATA& pRead)
at Test_PLCData.Form1.Button1_Click(Object sender, EventArgs e) in
C:\Esanti Code\C++\PLC_Data DLL\VB.NET Test App\Test PLCData\Test
PLCData\Form1.vb:line 106


Can anyone tell me how to get this to work correctly? Thanks in
advance!!!
AnswerRe: Marshalling Data, Can Anyone Help? Pin
NetPointerIN19-Sep-03 8:02
NetPointerIN19-Sep-03 8:02 
GeneralRe: Marshalling Data, Can Anyone Help? Pin
GrindAZ22-Sep-03 5:31
GrindAZ22-Sep-03 5:31 
GeneralRe: Marshalling Data, Can Anyone Help? Pin
NetPointerIN22-Sep-03 11:08
NetPointerIN22-Sep-03 11:08 
GeneralRe: Marshalling Data, Can Anyone Help? Pin
GrindAZ22-Sep-03 12:00
GrindAZ22-Sep-03 12:00 
GeneralFolder Size Pin
Ramaza18-Sep-03 6:53
Ramaza18-Sep-03 6:53 
GeneralRe: Folder Size Pin
Christian Eriksen10-Oct-03 14:34
Christian Eriksen10-Oct-03 14:34 
GeneralRe: Folder Size Pin
Christian Eriksen10-Oct-03 14:46
Christian Eriksen10-Oct-03 14:46 
GeneralRe: Folder Size Pin
Ramaza10-Oct-03 15:09
Ramaza10-Oct-03 15:09 
QuestionVBS scripting : How to access a HtmlDocument object ? Pin
Danoo18-Sep-03 3:36
Danoo18-Sep-03 3:36 
GeneralVB OCX Byte Data Type to MFC Pin
AntonioKeh17-Sep-03 23:50
AntonioKeh17-Sep-03 23:50 
GeneralRe: VB OCX Byte Data Type to MFC Pin
Ian Darling18-Sep-03 0:47
Ian Darling18-Sep-03 0:47 
GeneralRe: VB OCX Byte Data Type to MFC Pin
AntonioKeh18-Sep-03 1:11
AntonioKeh18-Sep-03 1:11 
GeneralRe: VB OCX Byte Data Type to MFC Pin
Ian Darling18-Sep-03 1:56
Ian Darling18-Sep-03 1:56 
GeneralList installed applications Pin
Anonymous17-Sep-03 9:34
Anonymous17-Sep-03 9:34 
GeneralRe: List installed applications Pin
Dangleberry21-Sep-03 22:49
sussDangleberry21-Sep-03 22:49 
GeneralProblem in On ERROR Pin
Meysam Khayatan17-Sep-03 8:35
Meysam Khayatan17-Sep-03 8:35 
GeneralRemote Database Connection Pin
abbasziyad17-Sep-03 2:02
abbasziyad17-Sep-03 2:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.