Visual C# Express 2010

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Visual C# Express 2010

Post by xol »

Message from Russ:
Thanks for your response and support. The package arrived today in fine shape and I've been spending the entire day (while snowed in) attempting to use it! Your demo/test program SubTool works just fine with it (as far as I've tested). However, my attempts to get the sample program or my own simple first attempt programs to work under Visual C# Express 2010 have all met with great frustration and failure!

I finally discovered the \doc\sub20net.pdf file, but I was already adding reference to sub20dnc.dll correctly, it seems. I couldn't glean much more help from that reference, though the rest of the document looks very useful once I am able to get something working. It would be nice if the examples were in C# and not just VB.

I finally discovered from something on your forum (or some website) that the resource name is Xdimax and not sub20dnc when one tries to add the line "using Xdimax" to the code. That got me a bit further... and to a successful compile... but it sure would have been nice to have found such information clearly written in some instructions at the start.

I can now build a project with no compile errors. It appears to run, but (when I have sub-20 open commands in it) I get the following error when the open() is attempted:

"Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

When your sample program is loaded it does say that a conversion to the new version is necessary, and that SEEMS to go okay with no problems until I get the above error when running and attempting to open() the device.

Since I am new to the Sub-20 and somewhat new to C# as well, I'm really at a loss now and have exhausted everything I can think of and everything I can find after many hours of web searching and reading your forum articles. Thus this email.

It would be nice to know that someone has actually run programs under Visual C# Express 2010, and to have a very trivial (but working) sample program of just a few lines that opens the Sub-20 device and does something. Even your simple SPI sample program (...\SUB-20\sample\.NET\c#\WindowsApplication1) would be quite useful IF it would work w/o the above error occurring each time the SPI button is clicked. It would be nice to know that the sample program has been verified that it actually DOES compile AND run with NO errors under this (free) platform. That alone would be such a great boost to productivity and permit me to then add my own code to achieve my desired ends.

You seem to have provided fantastic description of API syntax and usage, and great documentation on the hardware and jumpers, etc, but the new user is left in a state of puzzlement when the provided sample program gives an error that makes very little sense!

Thanks in advance for any help you can provide. I feel sure that one little missing piece of information will get me over this hump and allow me to use the Sub20 and all its power! :)

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: Visual C# Express 2010

Post by serg »

Hi Russ,
...It would be nice if the examples were in C# and not just VB.
vb.net and C# are very similar in terms of usage of the .NET components. All the differences fall into data types related and language syntax related. Let us know what vb.net sample you have difficulties with and we will provide you with appropriate C# code.
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
This is because the Visual Studio 2010 edition provides an option to choose which .NET framework version will be used by the executable(default is .NET v4) You can select the framework by using the "Application Properties"->"Target Framework" listbox. If your choice is .NET v4 you should add reference to the "C:\Program Files\SUB-20\bin\sub20dnc_v4.dll" and in case of .NET v2 add the "C:\Program Files\SUB-20\bin\sub20dnc.dll".

Post Reply