Stumped - reflection
Stumped - reflection
Stumped - reflection
Stumped - reflection
Stumped - reflection
Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection
Stumped - reflection Stumped - reflection
Stumped - reflection
Go Back  Xtreme Visual Basic Talk > > > Stumped - reflection


Reply
 
Thread Tools Display Modes
  #1  
Old 08-25-2015, 11:20 AM
GaryK GaryK is offline
Newcomer
 
Join Date: May 2008
Posts: 3
Question Stumped - reflection


I have multiple programs (screens) that are compiled to dll's. When the user selects a program, I dynamically load it into the main program using reflection and mdi forms. All or this works fine. The problem happens when I load a second instance of the same program. The new instance works OK. However the original seems to have problems. It is picking up data ald controls from the second instance!
Attached is a simple program that demonstrates the issue.
Once you click on Display in instance, the text boxes displays the data from the second instance and it populates the datagridview in instance #2.
I want the (2) instances to be totally independent of each other.
Is this a limitation of reflection or a coding problem? Is loading two or more of the same dll a problem?
Attached Files
File Type: zip reflection.zip (147.6 KB, 1 views)
Reply With Quote
  #2  
Old 08-25-2015, 01:15 PM
PlausiblyDamp's Avatar
PlausiblyDampStumped - reflection PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Not had chance to have a proper look at the code but my initial guess would be the fact you are using a module to store the various things. Modules are designed to be global, any variables declared in a module exist once for the entire application.

Try using a class to store this information and have each loaded instance declare it's own instance of this class.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 08-25-2015, 03:02 PM
GaryK GaryK is offline
Newcomer
 
Join Date: May 2008
Posts: 3
Default

Quote:
Originally Posted by PlausiblyDamp View Post
Not had chance to have a proper look at the code but my initial guess would be the fact you are using a module to store the various things. Modules are designed to be global, any variables declared in a module exist once for the entire application.

Try using a class to store this information and have each loaded instance declare it's own instance of this class.
I gave this a quick try in my test program and it looks like you are correct!
I have to do a lot more testing, but I think this is the correct direction.

Thanks,
This was a big help!
Reply With Quote
Reply

Tags
instance, program, reflection, data, load, boxes, loading, display, text, demonstrates, dll, issue, click, coding, simple, instances, datagridview, independent, displays, limitation, populates, totally, selects, user, dynamically


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Stumped - reflection
Stumped - reflection
Stumped - reflection Stumped - reflection
Stumped - reflection
Stumped - reflection
Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection Stumped - reflection
Stumped - reflection
Stumped - reflection
 
Stumped - reflection
Stumped - reflection
 
-->