473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Form problem with ActiveX DLL called from C#

Hi i am developing a Windows.Forms Application and I am using an
ActiveX dll built in C++.
I define a delegate for the eventhandler built in the DLL and using a
method that is bound to it. My main form is waiting for the event to
be occur. The problem is in the method that is bound to the delegate i
am trying to create a new form such as :

void X()
{
....
frm Form2 = new Form2();
frm.Show();

...

}

My form shows up but when the method X ends, my form is closed
automatically, even if I set the event in the Form2.Closing for
cancelling it, it is closed.
Got anyone any idea?
Nov 17 '05 #1
3 1214
Hi,

Declare the frm variable on the class level, not the method level. Make sure
that you dispose of the form when it's no longer needed.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Ata ?smet ?z?elik" <at********@uekae.tubitak.gov.tr> wrote in message
news:58*************************@posting.google.co m...
Hi i am developing a Windows.Forms Application and I am using an
ActiveX dll built in C++.
I define a delegate for the eventhandler built in the DLL and using a
method that is bound to it. My main form is waiting for the event to
be occur. The problem is in the method that is bound to the delegate i
am trying to create a new form such as :

void X()
{
...
frm Form2 = new Form2();
frm.Show();

..

}

My form shows up but when the method X ends, my form is closed
automatically, even if I set the event in the Form2.Closing for
cancelling it, it is closed.
Got anyone any idea?


Nov 17 '05 #2

Well I wrote it wrong.
I already defined in the class level so my correct code is :

frm = new Form2();

And frm is defined in the class level.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3


Any other ideas?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tony Pirkle | last post by:
I'm on a team converting a large VB6 enterprise solution into a VB.Net solution. We've started small. In other words, we're taking MS' advice and beginning with small pieces. I've created a...
6
by: Charles Banas | last post by:
weird subject - i hope more than just one curious regular will hear me out. :) ok, i've got a bit of a big problem, and i need answers as soon as possible. i know this forum is meant for web...
10
by: Greener | last post by:
Hi, I need help badly. Can you do client-side programming instead of server-side to capture the Browser type info? If this is the case, what's wrong with the following? <script...
7
by: TDIOwa | last post by:
I have a form that has a specific date on it. I want to open another form that has the Active Control Calendar on it. I want to open this form to the specific date on the first form. I have...
1
by: Craig | last post by:
I am having problems getting an ActiveX DLL written in VB6 to call a method in a C# class library component. My C# DLL is called CSharpProject.dll and contains a public class called CSharpClass....
0
by: Chance Hopkins | last post by:
I'm having trouble calling an interop dll from a asp.net web page. I think the problem is the activex dll (when called from a windows csharp form) launches a windows form with a progress bar. ...
0
by: Kimmo Laine | last post by:
Hi! I have old VB6 COM-component (inprocess server) which will display some info in a VB form: // In C# MyVBServer theServer = new MyVBServer(); theServer.ShowInfo(); When I call the...
20
by: vitorjol | last post by:
Hello. I have 2 forms (Form1 and Form2). When i call the Sub placed in form1 from form2, i get the error "object reference not set to an instance of an object" ! What can i do to solve the...
2
by: deccio | last post by:
I have create an activex Control with Visual studio 2005 and framework 2.0 in c# to add drag & drop functionality to upload multi file. When I use it in a windows form it work fine. Infact if I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.