AxImp and OCX

D

dream machine

Hi all ,
this is the first time that using .Net and C#
and
this is the first time that I write on this NG .

I have problem with OCX "avaibility" :

1. I have imported my OCX with AxImp
2. I have create one Instance of this Ocx that I have Imported
3. I have try to use one Method of this Ocx but I get this message error:

you not use the Mothod "nameMethod" at this time !

Uhmm ,
I Think that Ocx in the .NET Form must be "loaded" first that I call "nameMethod" .

But I haven't understand the way for get the Event from this Ocx that Allow me to understand
if it is really Loaded !

Tnx all , for any help !

dm
 
D

dream machine

Yes , I do .
I have skip the first step of my Programs when I have Write This email .

using System;
using System.Windows.Forms;
using AxMyOcx;

... code
... code

public static void Main()
{
AxMyOcxObject myOb = new AxMyOcxObject();

Form myForm = new Form(); // i create a Form
myForm.Controls.Add(myOb); // i add the OCX at form



// myOb.myMethod(); // If a Uncomment this line : << ERROR , You can't call myMethod at this time >>
myForm.ShowDialog(); // the Form show my Form and OCX inside the Form !
}


If I try to call "myMethod" after 2 o 3 seconds inside another place of my Program , it Work !
I concluded , that my OCX must be "loaded" before I use the myMethod ?

DM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top