Ryan,
Are you trying to create this on a thread that is not the UI thread? If
so, then yes, that is a problem.
Generally though, you will have to create it on a windows form (if it is
an ActiveX control) in order for it to work. You can always hide the
window, but it has to be hosted on a form.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Ryan Hunnicutt" <Ry***********@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
Thanks for the quick reply. Ok. I have a C# class library project with a
reference added for the OCX (USBTEMPAXLib). There is a class exposed
(USBTEMPAXLib.USBtempAxClass). I have the following code ->
USBTEMPAXLib.USBtempAXClass airtemp = new USBtempAXClass();
double temp = airtemp.Temperature;
When it hits the second line I get 'Catastrophic Failure'.
Does the component have to be hosted on a Windows Form to work? It does
work fine that way. Thanks for the help.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Ryan,
When you set a reference to the OCX, it should import wrappers for
all
of the classes that are publically exposed by that OCX. You should be
able
to access them now as it is.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Ryan Hunnicutt" <Ryan Hu*******@discussions.microsoft.com> wrote in
message
news:AC**********************************@microsof t.com... >I have a C# application that reads from a serial stream. This
>information
>is
> parsed out and saved to an xml file, also it is displayed in an GUI.
> The
> application actually reads data from two seperate COMM ports (one is
> lap
> times the other is track temperature readings). We recently purchased
> a
> USB
> device to read air temperatures. This device came with an OCX control.
> The
> problem I have is, if I have to put the OCX control in my form then I
> will
> have to use some ugly kludge to get the data from the device into the
> module
> that actually does the saving of the data. I hate ugly code. Is there
> anyway to instantiate a class from an OCX in a class library? So far
> I've
> had no success. Thanks.
>
> Ryan