Click here to Skip to main content
15,885,934 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: binding data with gridview Pin
Dave Kreskowiak13-Nov-09 4:27
mveDave Kreskowiak13-Nov-09 4:27 
QuestionRunning Value Question Pin
vbbeg12-Nov-09 20:46
vbbeg12-Nov-09 20:46 
QuestionSource code for SQL database Pin
Ravisubrahmanya12-Nov-09 20:14
Ravisubrahmanya12-Nov-09 20:14 
AnswerRe: Source code for SQL database Pin
Johan Hakkesteegt12-Nov-09 20:19
Johan Hakkesteegt12-Nov-09 20:19 
AnswerRe: Source code for SQL database Pin
Shameel12-Nov-09 22:54
professionalShameel12-Nov-09 22:54 
AnswerRe: Source code for SQL database Pin
Dave Kreskowiak13-Nov-09 4:19
mveDave Kreskowiak13-Nov-09 4:19 
AnswerRe: Source code for SQL database Pin
Oakman13-Nov-09 5:45
Oakman13-Nov-09 5:45 
QuestionInterop C++ dll from vb.net Pin
ggoutam712-Nov-09 20:07
ggoutam712-Nov-09 20:07 
Hi,

I am writing this only after exhausting effort to search and find the solution was unsuccessful.

I am using Visual Studio 2005. The Test123 function written in C++ should be called from vb.net by using Interop Services.
The Testing.dll is a CLR dll.

Below is a simplified version of the C++ structure :

typedef struct TEST_STRUCT<br />
{<br />
   long lTotal;<br />
   int nRow;<br />
   int nCol;<br />
   CString sName;<br />
   BOOL bFound;<br />
  	int item[100];<br />
} TEST;


Below is a simplified version of the structure declared in vb.net :

     <StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Ansi)> _<br />
    Public Structure TEST_STRUCT<br />
        ' ''<System.Runtime.InteropServices.FieldOffsetAttribute(0)> _<br />
        Public lTotal As Integer<br />
        Public nRow As Integer<br />
        Public nCol As Integer<br />
        <System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)> _<br />
        Public sName As String<br />
        <System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)> _<br />
        Public bFound As Boolean<br />
<br />
        '<System.Runtime.InteropServices.MarshalAsAttribute _<br />
        '(System.Runtime.InteropServices.UnmanagedType.SafeArray, SafeArraySubType:=Runtime.InteropServices.VarEnum.VT_I4)> _<br />
        <System.Runtime.InteropServices.MarshalAsAttribute _<br />
        (System.Runtime.InteropServices.UnmanagedType.LPArray, SizeConst:=100)> _<br />
            Public Item() As Integer<br />
    End Structure<br />
<br />
    Public Declare Auto Function Test123 Lib "Testing.dll" () As TEST_STRUCT<br />

What can work :
1) I can call the module Test123 from vb.net and it can run.
2) I can interop data for lTotal, nRow and nCol and receive at vb.net without any problem.

What my questions are :
1) How to interop data for sName, bFound and item[100]?
2) Which part I am wrong?
3) How should I declare the structure in vb.net to interop these data?
4) Can Interop support CString directly?
5) Is there any indirect way of marshaling which can work, such as doing the Interop in C# and then call from vb.net?

Your guidance on solving this problem is very much appreciated.

Thanks,
Goutam
AnswerRe: Interop C++ dll from vb.net Pin
Luc Pattyn13-Nov-09 1:11
sitebuilderLuc Pattyn13-Nov-09 1:11 
GeneralRe: Interop C++ dll from vb.net Pin
ggoutam715-Nov-09 21:05
ggoutam715-Nov-09 21:05 
GeneralRe: Interop C++ dll from vb.net Pin
Luc Pattyn16-Nov-09 2:46
sitebuilderLuc Pattyn16-Nov-09 2:46 
GeneralRe: Interop C++ dll from vb.net Pin
ggoutam717-Nov-09 0:04
ggoutam717-Nov-09 0:04 
GeneralRe: Interop C++ dll from vb.net Pin
Luc Pattyn17-Nov-09 1:07
sitebuilderLuc Pattyn17-Nov-09 1:07 
QuestionDelete Empty fields from array ! Pin
jeshra27912-Nov-09 11:46
jeshra27912-Nov-09 11:46 
AnswerRe: Delete Empty fields from array ! Pin
Christian Graus12-Nov-09 13:17
protectorChristian Graus12-Nov-09 13:17 
GeneralRe: Delete Empty fields from array ! Pin
Oakman12-Nov-09 15:31
Oakman12-Nov-09 15:31 
GeneralRe: Delete Empty fields from array ! Pin
EliottA12-Nov-09 15:37
EliottA12-Nov-09 15:37 
GeneralRe: Delete Empty fields from array ! Pin
EliottA12-Nov-09 15:38
EliottA12-Nov-09 15:38 
AnswerRe: Delete Empty fields from array ! [modified] Pin
MikeMarq12-Nov-09 16:47
MikeMarq12-Nov-09 16:47 
QuestionJunior Sql Query Pin
beker_usa12-Nov-09 11:20
beker_usa12-Nov-09 11:20 
AnswerRe: Junior Sql Query Pin
beker_usa12-Nov-09 11:29
beker_usa12-Nov-09 11:29 
GeneralRe: Junior Sql Query Pin
Christian Graus12-Nov-09 13:17
protectorChristian Graus12-Nov-09 13:17 
AnswerRe: Junior Sql Query Pin
Luc Pattyn12-Nov-09 11:59
sitebuilderLuc Pattyn12-Nov-09 11:59 
QuestionSplit string Pin
ivo7512-Nov-09 7:38
ivo7512-Nov-09 7:38 
AnswerRe: Split string Pin
Luc Pattyn12-Nov-09 7:42
sitebuilderLuc Pattyn12-Nov-09 7:42 

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.