[Tutor] Calling VB.NET code with Python .. VB.net - Python integration ..

bob gailer bgailer at gmail.com
Fri Sep 18 20:12:57 CEST 2009


Otonicar Ales wrote:
>
> The idea is that Python calls VB.net program. VB.Net program gets data 
> and than forward data back to Python for further processing..
>
>  
>
> One way to do this is by compiling vb.net program to exe. And than 
> call exe by Python code. Data exchange goes via Access Data Base 
> (Python write in MC Access, vb get data and than write it to MC 
> access, Python reads final data from MC access). In this case I will 
> need Python command to run exe which is enable Python waiting until 
> exe is not finished..
>
>  
>
> In case anybody out-there has better idea how directly communicate 
> with vb.net program (exchanging data  with variables - code 
> integration) please send code sample with a bit of explanation ..
>

You should set up the vb.net program to be a com server. Don't ask me 
how to do that.

Then get Python for Windows:
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/pywin32-214.win32-py2.6.exe/download

import wincom32.client
com = wincom32.client.Dispatch( application name or classid of the 
vb.net app)
# now you have a com object with which you can send commands to the 
vb.net app and receive data back.

-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list