Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi ive an activex made in vb6. Am new to .net and attempting to use it in vb2008. i made a reference to it and added the following code to my form_load

 

Dim mycon As New Axpass.Axiepass
       TextBox1.Text = mycon.GetIE()

but when the form loads it gives the error,

Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.

i also tried to add it as a control and call the method but it returns "" as the result, though the same method if called from a vb program works fine.. plz help and guide me..

  • Leaders
Posted

Based on what Google has to say, System.Windows.Forms.AxHost.InvalidActiveXStateException is often thrown when you try to access an ActiveX component that is not fully initiailized. (It's hard to do more than guess and Google when I don't know anything about the control in question.)

 

Not being much of an expert on the subject, if the Axpass.Axiepass class is written as an ActiveX control, I'm wondering whether the problem could be related to the fact that after you instantiate it, you don't place it in a control. After all, you don't get the exception when you place the control on a form.

 

The empty string that gets returned could likely be a completely separate issue. I have no idea what the function does, how it does it, or whether it does it 100% right. (Just because it works in VB6 doesn't mean everything is 100% kosher. It's possible to do something incorrectly and still have it succeed in certain circumstances.) You can try double-checking the ActiveX source to make sure everything looks spiffy, and you should definitely check and make sure you are using the control exactly the same in .NET that you are in VB6. Maybe there's an initialization method that needs to be called or a property that needs to be set. The .NET WinForms designer may also be setting some properties that the VB6 designer did not, or vice-versa.

[sIGPIC]e[/sIGPIC]
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...