Reusable Component, how to implement it?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form (FindForm) that provides search capabilities over
datagridviews. This search capabilities are called and used from several
forms in my application.

I want this form to be separate from the main application, so I defined it
as a class library and it is compiled into a dll.

My problem is that, when my main application calls the dll, it runs in its
own memory space (the FindForm appears as an independent application in
Windows, it does not appear in my application forms collection, etc).

Can anybody tell me how to implement this so my FindForm is not part of my
main application executable, but, at the same time, when called is included
in the main application memory space?

Thank you,

--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________
 
I think that you are referring to the fact that the form has the
ShowInTaskbar property set true. A form loaded from a DLL doesn't use it's
own application domain.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Hi Bob,

Thank you for your answer...

You are right my form has its ShowInTaskbar property set true, but there is
more... Let me try to explain it:

I am using VBasic .Net 2005

My application has MDI.

In my main application window I have a menu that includes the "Windows"
option, to show the list of opened forms at any time.

My FindData form (the one compiled into a dll), when called:
1) Does no appear in the list of opened forms
2) If it loses the focus, goes to the back of my MDI Parent form (out
of my application, it behaves as if it was an indpendent application)
3) If I open it as modal, it flickers when I click out of it.
4) It can be draged out of the main window.

This is what I need to change, I want this form to have the same behavior as
any other form in my application.

Can you help me with this?

Thank you,

--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________
 
I tried to do it form the calling application with:

Dim myNewFindData As New FindData.FindData(CType(ddatagridView.DataSource,
DataTable), Fields, myCurrencyManager)
myNewFindData.Parent = me

And it gave me the following error message "Top-level control cannot be
added to a control."

When I tried to do it from inside the FindForm, I can't seem to reach my
application main frame form.

My solution Structure, so far, has to projects:

Solution (2 Projects)
MyApp (the main program, defined as a Windows Application)
FindData (the FindData form, defined as a Class Library)
--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________
 
Thank you Bob,

I changed the signature of my FindForm New() method adding:

ByRef frmParent as Form
(I use it to pass a reference to the main form of my Application)

I added the following lines at the end of the new() method of my FindForm:
Me.TopLevel = False
Me.Parent = frmParent

And now almost all my problems are solved. Nevertheless I still have two:

My FindData form (the one compiled into a dll), when called:
1) Does no appear in the list of opened forms
2) If it loses the focus, it keeps hold of the foreground. Although I
can work with other forms and controls, the FindForm is always on top.

Any Ideas to improve this?

Thank you,

--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________
 
Thank you again, Bob.

I changed "Me.Parent = frmParent" to "Me.MDIParent = frmParent", just as you
said and now it is working just as I want it!


--
Sergio Torres C.
(505) 897 2041
___________________
http://www.stcsys.com
___________________
 
Back
Top