.net - Writing VB code for Oscilloscope as C# code -


i work in vb oscilloscope (the oscilloscope has it's own os). trying make c# executable same thing vb code , run on oscilloscope.

i trying write following vb code c#:

set app = createobject("lecroy.xstreamdso") wave = app.acquisition.c1.out.result.dataarray  msgbox(wave(1)) 

what connect oscilloscope software , output first element of waveform array.

this have tried far in c#: made form in vs2015 , made target .net 4.0 since oscilloscope running windowsxp , has .net 4.0 installed.

system.type objtype = system.type.gettypefromprogid("lecroy.xstreamdso"); dynamic comobject = system.activator.createinstance(objtype); var wave = comobject.acquisition.c1.out.result.dataarray; messagebox.show(wave(1)); 

basically put code inside button on form. when run on oscilloscope executable error: "unhandled exception has occurred in application." "cannot invoke non-delegate type".

can me doing wrong? appreciate it.

since .net4, can use dynamic :

type myoscapp= type.gettypefromprogid("lecroy.xstreamdso"); dynamic appinstance= activator.createinstance(myoscapp); appinstance.visible = true; 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -