Hey, I'm having a problem with one of my newest programs.

When you run it, it stores a .txt file with nothing in it just so that it can tell if you've run the program or not.

If you've never run the program, the .txt file won't be there, so it will run the GUI.

If you have run the program before, it sees the .txt file and doesn't open the GUI.

But when I try to do the if statement, and tell it to run on the exception of that .txt file, it gives me a namespace error. See below!

public static void Main()
        {
            _hookID = SetHook(_proc);
            appstart.startup();
            System.Timers.Timer timer;
            timer = new System.Timers.Timer();
            timer.Elapsed += new ElapsedEventHandler(appstart.OnTimedEvent);
            timer.AutoReset = true;
            timer.Interval = 600000;
            timer.Start();
            

			Application.Run();
            GC.KeepAlive(timer);

			//On first startup, give them a GUI. :)
			string txt = "check.txt";
    		String thismodulefilenamestr =	System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);
    	 	   if (System.IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.System ) + @"\" + txt))  
    	 	   {      }
    	 	   else  {  
    	 	Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new GUI());
    	 	   }
            UnhookWindowsHookEx(_hookID);
        }

It gives me this error

'GUI' is a 'namespace' but is used like a 'type' (CS0118)

What can I do to make it used like a.. namespace, maybe?

Thanks

Please use code tags when you send code!
GUI must normally be of type Form.
thismodulefilenamestr is initialised but never used.
Could you post us your whole project in a zip file?

This article has been dead for over six months. Start a new discussion instead.