473,386 Members | 1,786 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,386 software developers and data experts.

Instance

I'm trying to access a driver by producing a instance to
it, so I can talk to a USB divice. It was originally
written in Visual Basic 5.0. And I'm using Visual C#_2002,
and have add the reference to the driver. Here is how it
looks in Visual Basic 5.0 and would like to see what it
would look like in Visual C#. This is just part of the
problem, but one thing at a time.

Any thoughts would be appreciate.

'Declare an object variable to hold the device collection.
'We use WithEvents so that we can utilize the OnChange event.
Private WithEvents Connected As BDAQ.BBDaqEnum
Attribute Connected.VB_VarHelpID = -1

'Declare an object variable to hold a device.
'We use WithEvents so that we can utilize the
OnDataAvailable event
'during timed sampling.
Private WithEvents Device1 As BDAQ.BBDaqDevice
Attribute Device1.VB_VarHelpID = -1

Nov 15 '05 #1
3 1569
-----Original Message-----
I'm trying to access a driver by producing a instance to
it, so I can talk to a USB divice. It was originally
written in Visual Basic 5.0. And I'm using Visual C#_2002,
and have add the reference to the driver. Here is how it
looks in Visual Basic 5.0 and would like to see what it
would look like in Visual C#. This is just part of the
problem, but one thing at a time.

Any thoughts would be appreciate.

'Declare an object variable to hold the device collection.
'We use WithEvents so that we can utilize the OnChange event.
Private WithEvents Connected As BDAQ.BBDaqEnum
Attribute Connected.VB_VarHelpID = -1

'Declare an object variable to hold a device.
'We use WithEvents so that we can utilize the
OnDataAvailable event
'during timed sampling.
Private WithEvents Device1 As BDAQ.BBDaqDevice
Attribute Device1.VB_VarHelpID = -1


I guess I missed line here it is

Set Connected = CreateObject("BDaq.BBDaqEnum")
'create an instance of BBDaqEnum and set it to the variable

Nov 15 '05 #2
Bradley,

After you've added the reference to the driver, VS .NET has generated a so
called Interop assembly for you. This assembly contains wrappers enabling
you to access COM objects from managed code. The next steps for you will be:

1. Determine the namespace for the Interop assembly. You can find it out
with the Object Browser window inside the IDE, or with the ILDASM tool by
inspecting the assembly metadata. Most likely, the namespace will be the
same the name of the Interop assembly itself is.

2. Add a "using" statement with the namespace determined on step 1.

3. Add a "new" statement to the appropriate place in your code. This one
will probably look like this:

BBDaqDevice theDevice = new BBDaqDeviceClass().

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Bradley" <br*******@shaw.ca> wrote in message
news:06****************************@phx.gbl...
I'm trying to access a driver by producing a instance to
it, so I can talk to a USB divice. It was originally
written in Visual Basic 5.0. And I'm using Visual C#_2002,
and have add the reference to the driver. Here is how it
looks in Visual Basic 5.0 and would like to see what it
would look like in Visual C#. This is just part of the
problem, but one thing at a time.

Any thoughts would be appreciate.

'Declare an object variable to hold the device collection.
'We use WithEvents so that we can utilize the OnChange event.
Private WithEvents Connected As BDAQ.BBDaqEnum
Attribute Connected.VB_VarHelpID = -1

'Declare an object variable to hold a device.
'We use WithEvents so that we can utilize the
OnDataAvailable event
'during timed sampling.
Private WithEvents Device1 As BDAQ.BBDaqDevice
Attribute Device1.VB_VarHelpID = -1


Nov 15 '05 #3
Thanks for the info, it's a good place to start,

Bradley
-----Original Message-----
Bradley,

After you've added the reference to the driver, VS .NET has generated a socalled Interop assembly for you. This assembly contains wrappers enablingyou to access COM objects from managed code. The next steps for you will be:
1. Determine the namespace for the Interop assembly. You can find it outwith the Object Browser window inside the IDE, or with the ILDASM tool byinspecting the assembly metadata. Most likely, the namespace will be thesame the name of the Interop assembly itself is.

2. Add a "using" statement with the namespace determined on step 1.
3. Add a "new" statement to the appropriate place in your code. This onewill probably look like this:

BBDaqDevice theDevice = new BBDaqDeviceClass().

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Bradley" <br*******@shaw.ca> wrote in message
news:06****************************@phx.gbl...
I'm trying to access a driver by producing a instance to
it, so I can talk to a USB divice. It was originally
written in Visual Basic 5.0. And I'm using Visual C#_2002,
and have add the reference to the driver. Here is how it
looks in Visual Basic 5.0 and would like to see what it
would look like in Visual C#. This is just part of the
problem, but one thing at a time.

Any thoughts would be appreciate.

'Declare an object variable to hold the device collection.
'We use WithEvents so that we can utilize the OnChange event. Private WithEvents Connected As BDAQ.BBDaqEnum
Attribute Connected.VB_VarHelpID = -1

'Declare an object variable to hold a device.
'We use WithEvents so that we can utilize the
OnDataAvailable event
'during timed sampling.
Private WithEvents Device1 As BDAQ.BBDaqDevice
Attribute Device1.VB_VarHelpID = -1


.

Nov 15 '05 #4

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

Similar topics

5
by: Robert Ferrell | last post by:
I have a question about assigning __call__ to an instance to make that instance callable. I know there has been quite a bit of discussion about this, and I've read all I can find, but I'm still...
4
by: | last post by:
Hi I have a list containing several instance address, for example: I'd like to invoke a method on each of these instance but I don't know : 1. if its possible 2. how to proceed
18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
2
by: Mike | last post by:
Greetings, Having a major problem here. running version 8.2 on win2003 server. The problem I am having is backing up a database seems to get to the last part of the backup and then fails. This...
6
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? ...
6
by: Dmitry Karneyev | last post by:
Hi! I guess this question have been asked a lot of times, but please be tolerant and if you have any ideas share it. The question is: how to make availibale only one instance of application and...
2
by: Mesan | last post by:
Hello everyone, Thanks to many useful posts in this newsgroup and others, I've been able to come very close to something I've been wanting to do for a very long time. I've figured out how to...
1
by: vijay.db | last post by:
Hi Team, Very serious problem with my DB2 V8.1 Fixpack 6 running in AIX 5.1 machine. Every one hour my DB2 instance processes are killed and it's going down. Several trap files are generated in...
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
1
by: gzeng | last post by:
I am creating a singleton class in C++. Everything is fine except with the object pointers. I cannot instaniate a regular object. But I can define many pointers *aaaa, *bbbb, etc. to the class and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.