Click here to Skip to main content
15,900,108 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: update problem Pin
Vimalsoft(Pty) Ltd24-Mar-08 7:24
professionalVimalsoft(Pty) Ltd24-Mar-08 7:24 
Generalplease! i badly need help... Pin
sakhura_3123-Mar-08 22:56
sakhura_3123-Mar-08 22:56 
GeneralRe: please! i badly need help... Pin
Dave Kreskowiak24-Mar-08 3:55
mveDave Kreskowiak24-Mar-08 3:55 
GeneralRe: please! i badly need help... Pin
Christian Graus24-Mar-08 10:26
protectorChristian Graus24-Mar-08 10:26 
QuestionDeploy Crystal Report in Remote Server Pin
Abdul Rahman Hamidy23-Mar-08 22:35
Abdul Rahman Hamidy23-Mar-08 22:35 
GeneralRe: Deploy Crystal Report in Remote Server Pin
Dave Kreskowiak24-Mar-08 4:12
mveDave Kreskowiak24-Mar-08 4:12 
GeneralRe: Deploy Crystal Report in Remote Server Pin
Kschuler24-Mar-08 4:51
Kschuler24-Mar-08 4:51 
QuestionCalling .NET component from VB6. Pin
SPanicker*23-Mar-08 21:57
SPanicker*23-Mar-08 21:57 
I am trying to work out a simple COM/.NET interop code. In my project in VB, I have created a simple windows application to add two numbers. The functionality of adding is done through the help of a .NET DLL written in C#. I am quite confused by trying various ideas sugggested by people. Can anyone clarify this simply in a step by step fashion?

This my VB code:

<br />
<br />
Private Declare Function method Lib "C:\Documents and Settings\CSfiles\interop\interop\bin\Debug\interop.dll" Alias "interopdll" (ByVal X As Integer, ByVal X As Integer)<br />
<br />
Private Sub Command1_Click()<br />
<br />
Dim a As Integer<br />
Dim obj As Object<br />
<br />
obj = New sample ' I get a compile-time error for undefined user type here.<br />
<br />
a = obj.method(CInt(Text1.Text), CInt(Text2.Text))<br />
Label1.Caption = CStr(a)<br />
<br />
End Sub<br />
<br />


My C#(.NET DLL) Code:

<br />
<br />
using System;<br />
using System.Runtime.InteropServices;<br />
using System.Reflection;<br />
<br />
[assembly: ComVisible(true)]<br />
namespace interop<br />
{<br />
/// <summary><br />
/// Summary description for Class1.<br />
/// </summary><br />
<br />
[ClassInterface(ClassInterfaceType.AutoDual)]<br />
<br />
[GuidAttribute("6CE9C732-CD90-4042-A5F0-CF71DFAC2598")]<br />
<br />
class sample<br />
{<br />
public sample()<br />
{<br />
}<br />
public int c;<br />
<br />
public void method(int a, int b)<br />
{ <br />
c = a+b;<br />
//return c;<br />
} <br />
}<br />
}<br />
<br />


In this I have registerd the DLL with /codebase switch while using regasm.exe too.

Regards,
Lenus.

GeneralRe: Calling .NET component from VB6. Pin
Dave Kreskowiak24-Mar-08 4:10
mveDave Kreskowiak24-Mar-08 4:10 
GeneralRe: Calling .NET component from VB6. Pin
SPanicker*24-Mar-08 4:38
SPanicker*24-Mar-08 4:38 
GeneralRe: Calling .NET component from VB6. Pin
Dave Kreskowiak26-Mar-08 13:23
mveDave Kreskowiak26-Mar-08 13:23 
GeneralPopup Message Box in Windows Service Pin
vijay_8323-Mar-08 20:15
vijay_8323-Mar-08 20:15 
GeneralRe: Popup Message Box in Windows Service Pin
Dave Kreskowiak24-Mar-08 4:07
mveDave Kreskowiak24-Mar-08 4:07 
QuestionAssemble captured image packets and display Pin
Dan Worthington23-Mar-08 11:12
Dan Worthington23-Mar-08 11:12 
GeneralRe: Assemble captured image packets and display Pin
A Wong24-Mar-08 7:06
A Wong24-Mar-08 7:06 
Generalplease i need real help ( iam tiered from it) Pin
asha_s23-Mar-08 8:54
asha_s23-Mar-08 8:54 
GeneralRe: please i need real help ( iam tiered from it) Pin
Christian Graus23-Mar-08 11:27
protectorChristian Graus23-Mar-08 11:27 
GeneralRe: please i need real help ( iam tiered from it) Pin
asha_s24-Mar-08 0:09
asha_s24-Mar-08 0:09 
GeneralRe: please i need real help ( iam tiered from it) Pin
Dave Kreskowiak24-Mar-08 4:05
mveDave Kreskowiak24-Mar-08 4:05 
GeneralRe: please i need real help ( iam tiered from it) Pin
asha_s24-Mar-08 7:40
asha_s24-Mar-08 7:40 
GeneralRe: please i need real help ( iam tiered from it) Pin
Dave Kreskowiak26-Mar-08 6:47
mveDave Kreskowiak26-Mar-08 6:47 
GeneralRe: please i need real help ( iam tiered from it) Pin
asha_s26-Mar-08 7:18
asha_s26-Mar-08 7:18 
GeneralRe: please i need real help ( iam tiered from it) Pin
Dave Kreskowiak26-Mar-08 7:20
mveDave Kreskowiak26-Mar-08 7:20 
GeneralHelp on a program Pin
antlex23-Mar-08 6:26
antlex23-Mar-08 6:26 
GeneralRe: Help on a program Pin
pmarfleet23-Mar-08 7:11
pmarfleet23-Mar-08 7:11 

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.