PDA

View Full Version : Casting AXTXTextControl to TXTextControl


Derek Iovieno
December 5, 2003, 22:37:21
We are evaluating developing both .NET Windows Applications and ASP.NET Server Side Applications using the TXTextControl 10.1 ActiveX client and server using C#.

We want to use the ActiveX control in both environments so we can share common code between the two applications.

When I add the TXTextControl to a windows form, it is added as a AxTx4oleLib.AxTXTextControl object and when I added it to an ASP.NET code behind page it is a Tx4oleLib.TXTextControl object.

My goal is to have functions that take Tx4oleLib.TXTextControl as an arguement so I can use them in both environments. Attempts at casting a AxTx4oleLib.AxTXTextControl to a Tx4oleLib.TXTextControl results in a cast exception. Is there any known way to perform this cast operation?

Derek Iovieno
December 9, 2003, 20:57:17
Actually in the C# code behind page I reference the TextControl as Tx4oleLib.TXTextControlClass.

So I am looking to cast a AxTx4oleLib.AxTXTextControl object to a Tx4oleLib.TXTextControlClass object, or any other way to reference the TextControl the same way in both environments to reuse my functions.

Derek Iovieno
December 10, 2003, 03:52:36
The solution turned out to be quite easy.

(Tx4oleLib.TXTextControl) TX.GetOcx();

Where TX is a AxTx4oleLib.AxTXTextControl

Meik Dankleff
December 10, 2003, 17:42:26
Well, I have to remember that... *g*