There is an article on Code Project by Detlef Grohs that describes the process for creating a single instance application in VB.NET. You could use the same technique with modifications to achieve what you want. It involves using Mutexes and .NET Remoting. The article is here: http://www.codeproject.com/vb/net/sing_inistan.asp[^]
hi, I am using following code to invoke my DLL and it's functions.
Assembly assemScenarioPreview = Assembly.LoadFrom(Some Path);
Type typeScenarioPreview = assemScenarioPreview.GetType(...);
Object obj = Activator.CreateInstance(typeScenarioPreview);
MethodInfo methodofScenarioPreview = typeScenarioPreview.GetMethod("Run");
methodofScenarioPreview = typeScenarioPreview.GetMethod("CleanUp");
In first chance it's get executed. but next time it throws an Exception.
"Exception has been thrown by the target of an invocation"
If I closed the client then then again ran the same code. it works..
What is the possible problem ..
Generally, a try/catch block around this will let you see what the exeption says about itself. Very useful stuff. Do something like the following, and you'll get information about the exception. (Also, be aware that the InnerException memeber may need to be looked at in some rarer occasions.)
// Your code here.
catch (Exception err)
"We want to be alone when we hear too many words and we feel alone when it has been a while since anyone has spoken to us." Paul David Tripp -- War of Words
Please help me if you know the answer to this. I want to create a dataAdapter, that fills a dataSet. However, I have a stored procedure that I want to use, that takes one int as input. I have been trying this for a few hours now, and have come no closer.
when i use tabcontrol,i find that there is no property for the tabpage to visible or unvisible.i want make tabpage1 to visible but tabpage2 to unvisible,but beacause there some progress need controls on tabpage2,so i can remove tabpage2,i just want to make it unvisible.how can i make that?
SolidBrush Brush = new SolidBrush(Color.Black);
Point point1 = new Point(4, 4);
Point point2 = new Point(50, 4);
Point point3 = new Point(4, 4);
Point point4 = new Point(4, 100);
Point point5 = new Point(50, 4);
Point point6 = new Point(50, 100);
Point point7 = new Point(4, 100);
Point point8 = new Point(27, 120);
Point point9 = new Point(50, 100);
Point point10 = new Point(27, 120);
I am using mid form in a windows forms application. Every time I am loading new child windows memory is going up(it’s ok). When I close them memory is not coming down. I am disposing child windows as they close.
Why is this happening ?
What is the solution for this problem ?
What are the best practices for memory management.
If you are using task manager to detect memory usage, what you are seeing is the programs working set and not the atuall memory usage.
You say you are using the Dispose method as you close windows. But do those child windows use any resources that are not automatically disposed?
Contrary to popular belief, .NET's automaticall memory management does not imply immediate 100% resource cleanup. Some resources have to be cleaned up manually to decrease memory footprint at any given time since the garbage collector funtions in a non-deterministic way.
Task manager show the program's working set, not the actual memory consumption at a given time. You can see this bi minimizing and then restoring your application. Task Manager refreshes the value and usually the new value is much less than the original one.
Although it is not a recommended practice, you can try forcing a garbage collection through GC.Collect().