Hi Guys.
I've been searching the web for a solution but it seams as though I have to ask a question....LOL
I have a couple of Projects consisting of a fex apps and Dll's all in one solution. One of my Classes is Called GlobalVariables which is referenced in all the apps and dll's and coded like this:
namespace GlobalVariables
{
public class GlobalVariables
{
private static GlobalVariables TheSingleGlobalVariableInstance = null;
public GlobalVariables()
{
}
public static GlobalVariables GetGlobalVariables()
{
if (TheSingleGlobalVariableInstance == null)
{
TheSingleGlobalVariableInstance = new GlobalVariables();
}
return TheSingleGlobalVariableInstance;
}
public static String ADOConDMU = "Data Source = \\Program Files\\DMU\\Database\\HDDR8_BASIC_DMU.sdf ; Password = lassa";
public static System.Data.SqlServerCe.SqlCeConnection conn = new SqlCeConnection("");
public static System.Data.SqlServerCe.SqlCeCommand cmd = new SqlCeCommand();
public static int Result4, Result6 = 0;
public static Assembly DMUAssembly;
public static Type Mytype;
public static MethodInfo Mymethod;
public static Object obj;
}
}
I've put a simple code snipet in all of the apps and dll's to look at the variable "Result6" and write it out, but I change the value of Result6 every 10sec in my main app...Here is the snipet in the main app:
private void timer1_Tick(object sender, EventArgs e)
{
GlobalVariables.GlobalVariables.Result6 = GlobalVariables.GlobalVariables.Result6 + 10;
Console.WriteLine("This is the DMUServer : {0}", GlobalVariables.GlobalVariables.Result6);
}
and in everything else
void timer_Tick(object sender, EventArgs e)
{
DateTime mm = DateTime.Now;
Console.WriteLine("This is the TestComms : {0} at {1}", GlobalVariables.GlobalVariables.Result6, mm);
}
Now, my problem is that all the Dll's can see and write out the right value ("Each time it is changed"), but the EXE's(Other Apps) seams to be making a new instance of GlobalVariables and doesn't seam to see the changes value.....
Some one please help....I don't see what I'm doing wrong...
Thanx In advance.