|
there is no need to use a timer. there are events raised when a form loses focus - you probably want to handle the Deactivate event and close the form in that handler.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
Wow... That worked like a charm... Thanks alot...
M sorry but, i hadn't mentioned before, but there are two buttons on this second form, Which when clicked One opens the openfiledialog and the other folderbrowser.
The problem is when i click any of the buttons it will bring up the Dialogs and so the form gets deactivated, as a result the dialog boxes also gets closed.
Any way to work around this???
modified 1-Jan-14 6:17am.
|
|
|
|
|
Create a flag that you set right before the dialog is shown and cleared when the dialog is dismissed. Check tge value of the flag in your event handler.
|
|
|
|
|
Thanks alot... It works...
|
|
|
|
|
I think the codes should like this:
private void Form1_Deactivate(object sender, EventArgs e)
{
this.Hide();
}
|
|
|
|
|
How to create a console window along with a GUI application ?
then the system.console.writeline can output from this console window ,
like add the "editbin /SUBSYSTEM:CONSOLE $(OutDir)/$(ProjectName).exe" in the post-build event in a C++ project .
Thanks !
heartofdra
|
|
|
|
|
The "Gui Application" is WinForms ? WPF ?
“I'm an artist: it's self evident that word implies looking for something all the time without ever finding it in full. It is the opposite of saying : 'I know all about it. I've already found it.'
As far as I'm concerned, the word means: 'I am looking. I am hunting for it. I am deeply involved.'”
Vincent Van Gogh
|
|
|
|
|
any difference ?
how about the WinForms ?
heartofdra
|
|
|
|
|
How about Win Forms [^].
“I'm an artist: it's self evident that word implies looking for something all the time without ever finding it in full. It is the opposite of saying : 'I know all about it. I've already found it.'
As far as I'm concerned, the word means: 'I am looking. I am hunting for it. I am deeply involved.'”
Vincent Van Gogh
|
|
|
|
|
I got it ----- "output type "
thanks
heartofdra
|
|
|
|
|
This will create a Console application, not a WinForms. It's not a good idea because this creates a few problems for your WinForms app that you have to code around.
Put it back to what it was. In your application, you have a couple of ways of creating a console window. One is to use the Win32 functions AllocConsole and AttachConsole. You then have to get the streams from the console and attach them to .NET streams, ... It's pretty messy.
A simple method it to launch CMD.EXE as a new Process, then you've already got the stream objects to write to. You can't use Console.WriteLine, but you can use something like myCmdProcess.StandardInput.WriteLine. StandardInput is a normal StreamWriter object which has all the usual methods you would expect[^].
|
|
|
|
|
There isn't really a nice way to do this - the UI needs a separate thread to your console stuff. Which gives problems when you want to shut things down...
The easiest way is to create your app as a console app, and add a form to that - it's not "nice" but it will work:
private static MyForm myForm = new MyForm();
static void Main(string[] args)
{
Console.WriteLine("Console");
Thread t = new Thread(() => myForm.ShowDialog());
t.Start();
while (true)
{
string s = Console.ReadLine().ToUpper();
if (s == "X") break;
}
if (t.IsAlive)
{
myForm.Invoke(new MethodInvoker(delegate { myForm.Close();}));
}
}
Never underestimate the power of stupid things in large numbers
--- Serious Sam
|
|
|
|
|
I believe this[^] is what you want to do.
Edit: A better link here[^].
/ravi
|
|
|
|
|
Hello,
There are 3 Windows Service I am running now and one service stops automatically without any error (I have try and catch blocks to capture errors and log in a text file). At first I thought it is due to tuneup maintenance and antivirus program I'm running but if it is the case, shouldn't all services stop?
I put them on recovery mode to restart after fail, but it doesn't work for that particular windows service. How do I check what stops the service? And how do I set recovery options programmatically?
Hope someone can help me. Thank you!
modified 2-Jan-14 4:16am.
|
|
|
|
|
|
Yes, I did. Without any exception or error, the service stops and can see event log entry "In OnStop" there.
|
|
|
|
|
There is no way to determine what told your service to stop unless the program that did it out something in the event log saying that it is stopping your service.
|
|
|
|
|
Now I know why!
My Norton antivirus terminates my services! It says Generic Load Point detected by Virus Scanner and it terminates and removes my services! How can I prevent this? I couldn't find any setting to exclude these particular services during virus scan.
|
|
|
|
|
I don't use Norton Antivirus so I don't know. Either someone who does use it is going to have to answer (good luck waiting for that), or you contact Symantec Support and ask them.
|
|
|
|
|
That would be silly to wait. Anyway thanks! I've figured it out.
|
|
|
|
|
How exactly do you know that it "stops automatically"?
How do know it even started? How do you know it started successfully?
Did you check to see if the server restarted? And if it did restart then did the service correctly start?
|
|
|
|
|
Hello
when the user print any document in virtual printer how i can receive what he print in my application.
How I can receive what the user print in my application.
Note :I use Redmon and Ghostscript
And Redmon redirect to my application but how I can receive in my application
thanks
|
|
|
|
|
i am have WPF app to capture image ((BitmapSource)imgCapture.Source )from camera after capture image i want to rotate this image 180 degree pixel by pixel ????
|
|
|
|
|
Then try the WPF forum.
Veni, vidi, abiit domum
|
|
|
|
|
Hello all,
I added a new dynamicdata\custompage aspx page to the existing Data Scaffolding project. I want to remove the existing "delete" option in the gridview, and hence need to create a custompage to accomplish this.
How to make sure the default page is reading this newly created page? I rebuilt the solution. but every time I try to access this page, it comes back with a page not found message.
Am i missing something?
Thank you!
|
|
|
|