473,241 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

calling a C# method asynchronously from VB

Lak
Hi all
I am trying to call a C# method (in a DLL) asynchronously from VB. I don't
know how to do this. Any suggestion is appreciated. Thanks.
Jan 17 '06 #1
6 1676
Lak wrote:
I am trying to call a C# method (in a DLL) asynchronously from VB. I don't
know how to do this. Any suggestion is appreciated. Thanks.


Do you mean VB6 or VB.NET?

Jon

Jan 17 '06 #2
Lak
VB6.0

"Jon Skeet [C# MVP]" wrote:
Lak wrote:
I am trying to call a C# method (in a DLL) asynchronously from VB. I don't
know how to do this. Any suggestion is appreciated. Thanks.


Do you mean VB6 or VB.NET?

Jon

Jan 17 '06 #3
Lak wrote:
VB6.0


Ah. That makes life a bit harder - and I can't help you. I suggest you
wait a while for answers in this group, and if nothing helpful comes
along, try asking again in the .interop group.

Jon

Jan 17 '06 #4
Please define what you mean with 'asynchronously', your only option to call
into C# is through COM interop and such method calls are always synchronous.

What exactly are you trying to achieve?

Willy.


"Lak" <La*@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
| VB6.0
|
| "Jon Skeet [C# MVP]" wrote:
|
| > Lak wrote:
| > > I am trying to call a C# method (in a DLL) asynchronously from VB. I
don't
| > > know how to do this. Any suggestion is appreciated. Thanks.
| >
| > Do you mean VB6 or VB.NET?
| >
| > Jon
| >
| >

Jan 17 '06 #5
Lak
I have a C# method that will run for a while. While it runs, I don't want to
lock up the GUI. I need to retrieve some progress information from the C#
DLL. Therefore, I want to run the first method asynchronous so that I can use
another method to retrieve progress info. Does this help? Thanks for your
reply.

"Willy Denoyette [MVP]" wrote:
Please define what you mean with 'asynchronously', your only option to call
into C# is through COM interop and such method calls are always synchronous.

What exactly are you trying to achieve?

Willy.


"Lak" <La*@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
| VB6.0
|
| "Jon Skeet [C# MVP]" wrote:
|
| > Lak wrote:
| > > I am trying to call a C# method (in a DLL) asynchronously from VB. I
don't
| > > know how to do this. Any suggestion is appreciated. Thanks.
| >
| > Do you mean VB6 or VB.NET?
| >
| > Jon
| >
| >

Jan 17 '06 #6
Lak,

The problem with this involves the threading model that is inherent to
VB.

While you could start an asynchronous operation in VB (calling a .NET
component) and then provide some sort of callback, the problem is that you
have to call back on the thread that the component was created on. This
presents a problem.

The easiest way to do this would be to create an interface that
represents the callback which your VB component will implement. You then
pass this interface in a call to start the asynchronous operation. You can
then pass this interface to your thread, which will call back on the
interface.

The only problem here is that you have to marshal the interface
correctly, using the global interface table. You can do this using the
IGlobalInterfaceTable interface (through COM interop), or the
CoMarshalInterThreadInterfaceInStream function.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Lak" <La*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
I have a C# method that will run for a while. While it runs, I don't want
to
lock up the GUI. I need to retrieve some progress information from the C#
DLL. Therefore, I want to run the first method asynchronous so that I can
use
another method to retrieve progress info. Does this help? Thanks for your
reply.

"Willy Denoyette [MVP]" wrote:
Please define what you mean with 'asynchronously', your only option to
call
into C# is through COM interop and such method calls are always
synchronous.

What exactly are you trying to achieve?

Willy.


"Lak" <La*@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
| VB6.0
|
| "Jon Skeet [C# MVP]" wrote:
|
| > Lak wrote:
| > > I am trying to call a C# method (in a DLL) asynchronously from VB.
I
don't
| > > know how to do this. Any suggestion is appreciated. Thanks.
| >
| > Do you mean VB6 or VB.NET?
| >
| > Jon
| >
| >

Jan 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Al Christoph | last post by:
I have a program that mixes wizard like behavior with random access to the various dialogs in the wizard. I do this by having each step map to a toolstripmenuitem. Users can randomly choose the...
15
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
0
by: han zhiyang | last post by:
I've just studied the "how to" web service and the async pattern in donnet.I make a test with these knowledges,but I got a strange result. Here is my test. 1.Write a simple "Add" service named...
1
by: Lak | last post by:
Hi all I am trying to call a method from a C# dll asynchronously from VB. I don't know how to do this. Please get back to me with your suggestions. Thanks.
1
by: JamesK | last post by:
Hi there, Hoping someone might have an idea of whats going on here, I presume I'm in the right forum but not 100%. I have a java web service that I am using with a C# .NET client. ...
4
by: Edwin Gomez | last post by:
I'm a C# developer and I'm new to Python. I would like to know if the concept of Asynchronous call-backs exists in Python. Basically what I mean is that I dispatch a thread and when the thread...
0
by: =?Utf-8?B?dGhlamFtaWU=?= | last post by:
In the sample VB application for Filestream.BeginWrite Method, there is no NEW implementation on the AsyncCallBack Object and sample below calls for declaring both the "State" object and the...
9
by: Pubs | last post by:
Hi all, I want to call a function with some intial parameters with in a thread. At the end of the function execution it should return a value to the caller. Caller is outside the thread. ...
3
by: John Skandar | last post by:
I've found a free WebService on the net for a currency converter and have created a class to use it with the WSDL tool. I call the WebService method asynchronously: ...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.