Hi,
I have a C# application (VS2005) with Microsoft Mappoint activeX control on
a form. At a certain moment I want to create a second one temporary in code.
This seems not to work, when I try to access it I have an InvalidActiveXS tate
Exception.
I cannot find mutch on the web about this Invalid State of a component
except that it is invalid (what the Exception already describe). So I hope
someone here knows ?
It cannot be difficult to create an ActiveX component at runtime ? Are there
special things to do with it except calling the constructor with New ?
--
rgds, Wilfried http://www.mestdagh.biz 4 6789
Wilfried,
I'm not sure exactly what you have to do, but, if I was facing this, I
would look at the area in the designer code and see how it is instantiating
the control, and see if there is a difference in the way that you are doing
it, versus how the designer is doing it.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Wilfried Mestdagh" <Wi************ **@discussions. microsoft.comwr ote in
message news:3C******** *************** ***********@mic rosoft.com...
Hi,
I have a C# application (VS2005) with Microsoft Mappoint activeX control
on
a form. At a certain moment I want to create a second one temporary in
code.
This seems not to work, when I try to access it I have an
InvalidActiveXS tate
Exception.
I cannot find mutch on the web about this Invalid State of a component
except that it is invalid (what the Exception already describe). So I hope
someone here knows ?
It cannot be difficult to create an ActiveX component at runtime ? Are
there
special things to do with it except calling the constructor with New ?
--
rgds, Wilfried http://www.mestdagh.biz
Wilfried Mestdagh wrote:
Hi,
I have a C# application (VS2005) with Microsoft Mappoint activeX control on
a form. At a certain moment I want to create a second one temporary in code.
This seems not to work, when I try to access it I have an InvalidActiveXS tate
Exception.
I cannot find mutch on the web about this Invalid State of a component
except that it is invalid (what the Exception already describe). So I hope
someone here knows ?
It cannot be difficult to create an ActiveX component at runtime ? Are there
special things to do with it except calling the constructor with New ?
Hi,
from my experience this can come from one or both of two things.
A lot of ActiveX controls require a call to BeginInit before you access
its properties:
AxHost activeX = ...;
activeX.BeginIn it()
// do something
activeX.EndInit ();
The second thing is that some ActiveX controls need to have a parent to
work correct. (After all they are ActiveX controls).
AxHost activeX = ...;
activeX.BeginIn it()
// parent the control
Controls.Add(ac tiveX);
activeX.EndInit ();
This however will make the control visible.
HTH,
Andy
Hi,
Thank you. It was the Controls.Add() that did it. I set Visible to false and
it is ok too. I use it in a using block to make suer it is disposed.
--
rgds, Wilfried http://www.mestdagh.biz
Wilfried Mestdagh wrote:
Hi,
Thank you. It was the Controls.Add() that did it. I set Visible to false and
it is ok too. I use it in a using block to make suer it is disposed.
Hi,
if you are using .NET 1.1: We have found a memory leak when we dispose
ActiveX controls. Depending on the size and type of your ActiveX and how
often you create/dispose it, you might want to do something about it.
The ActiveX hooks the VisibleChanged event of the main form when added
to another control and does not unhook it on Dispose(). This means that
the ActiveX will not be garbage collected as long as the main form
lives. If your ActiveX releases all resources on dispose properly, you
only will only notice a increase on the GC Handles.
One solution would be to keep he control creates and invisible. Another
one is to unhook the event using reflection.
This issue seems to be fixed in .NET 2.0.
Cheers,
Andy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mattt |
last post by:
Hi,
I've run into a rather odd problem. get Methods seem to return values
from the wrong methods! For example, let's pretend my activex control
stores values about a person. getName would return their age, while
getAge might return null! Something is also going wrong with my method
that accepts input and returns a value (okay, it is a money conversion
program!)... it is returning null!
They are consistently returning the same, wrong...
|
by: Joe |
last post by:
I've been running into problems when trying to create a Virtual FTP folder
in ASP.Net. I've tried it a few ways but none of them has worked so far. I
have identity impersonation turned on, and the current user is an
administrator on the machine, so I wouldn't think it's a permissions issue,
but I can't think of anything else that it might be. The first way I tried,
which worked fine in ASP but not ASP.Net, is:
Dim Path
Dim ftpSvc
Dim...
|
by: Steve |
last post by:
Can anyone point me to a primer for creating OCX controls in VB .net? In particular, I want to access a web service in a VB6 application (not an easy thing to do). So, if I can write an ActiveX control that accomplishes this in .Net, then I SHOULD be able to add the OCX component to my VB6 app and use it. Unless someone knows why this wouldn't work....
Any and all help is appreciated.
|
by: DraguVaso |
last post by:
Hi,
In my application, on some given actions while debugging in Visual Studio, I
suddenly get a "System.ComponentModel.Win32Exception was unhandled"
Message="Error creating window handle." exception.
The problem is that this exception isn't raised somewhere in a method, so it
just shows up, and it causes the application to shut down.
Is there anyway how to catch this kinds of exceptions? Can I put somewhere a
|
by: Casper |
last post by:
I am issuing the following commands in a form's detail on click event.
Private Sub Detail_Click()
Dim Nline As Line
Set Nline = New Line
I get :"ActiveX component can't create object"
According to MS Help this means the <"Line"?> class is not registered
in the registry.
| |
by: Raed Sawalha |
last post by:
Hello I have ActiveX DLL and I usually register it using following procedure
1. gactutil -i ActiveXDLL
2. regasm ActiveXDLL /tlb:DLLNAME/codebase
3. then using the activeX
can I automate step 1 and 2 inside ActiveX itself
|
by: Carlos Lozano |
last post by:
Hi,
What is the right way to create an OCX COM component. The component is
already registerred, but can't create an instance. I am using the reference
to the interop module created.
If I use javascript or vbscript it works.
I will appreciate any help.
I do the following (C#):
|
by: Rocio |
last post by:
I have a windows app. written in VB6, now we need to expose some of
its classes through a web service.
I am only able to expose the classes using late binding becasue that's
the way the original VB6 was written. I ahve already exposed some of
the original classes, and they work fine. Now, I added a new ActiveX
component to the windows app (in vb6). I am able to call it by late
binding from within the vb6 app. itself, and from a dummy vbs...
|
by: hufaunder |
last post by:
I have an ActiveX component that I want to use in a library that I am
writing. As a first test I used the ActiveX component in a windows
form application. Adding the component created:
Ax.dll
.dll
I can not call the functions in the ActiveX component. In the next
step I tried to use the ActiveX component in a class library. I simply
added a reference to the corresponding COM component. This this only
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |