|
It ends the console window as well, I only want to exit the program.
|
|
|
|
|
No, it unloads the CLR and quits the application. If you start the command prompt and then run your application, you'll see it doesn't close the command prompt. If you simply execute your console application, a command prompt is started. When your application exits, the command prompt exits as well because it was only started for your console application.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
If the program is launched by double-clicking on the .EXE, the Console window will close when the app closes. You can't stop it.
But, if you double click on a shortcut icon that has a target line like this:
cmd /K "C:\full path to.exe"
then the Console will stay open after the user exists the program.
RageInTheMachine9532
|
|
|
|
|
Probably you could try
Process myProcess = Process.GetCurrentProcess() ;
myProcess.Kill();
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
The console that is launched with the process will also be killed. He wants to the console to stay open when the app is killed off. This has to be done by launching two seperate processes. The command shell first, then the command shell has to launch the app for this effect to be seen.
RageInTheMachine9532
|
|
|
|
|
Hi
I have a COM+ .NET components that runs as a Server application. I have to configure it for ExceptionManagement blocks, but I don't how to do it (not the ExceptionManagement block, but the location of the configuration file).
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
|
I forgot to mention that it is on Win2K. There is no Application Root Directory for this version of Windows.
For now, I only know of 2 ways, none of them elegant:
1- Put it in the Machine.config file
2- Create a dllhost.exe.config file
The problem with both solutions is that the configuration settings will be the same for all serviced components.
Tx for your time.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I wonder if it's possible to simulate the mouse's click behavior thru SendMessage API function. I just want to know If you have came up to this idea before. For example, consider there is a File menu in the upper-left corner of my form, and say its (x, y) coordinates are (20, 20). Now, is it possible to open the File menu by sending a Click event with appropriate x,y coordinates using SendMessage API?
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
Yes. That's one of the things that SendMessage does. If you're not sure how to use it, read about the P/Invoke (Platform Invoke) functionality of C# and .NET.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hi.
im new to c# so pls bear with me and teach me.....
i have created an MDI app, so i have three forms. frmMain , frmChild1 and frmChild2.
in frmMain i have a button which will call frmChild2..
button click event
{
frmChild2 c2 = new frmChild2();
this.MdiParent();
c2.Show();
}
and in frmChild2 i have a button callin frmChild3(this is also a child of frmMain)
button click event
{
frmChild3 c3 = new frmChild3();
/* how do i assign frmMain as the parent form?... */
c3.Show();
}
i also have another problem when i click the button twice, two identical forms pop up...how do i check to see if the form is already open, just direct the user to it and if its closed then open one?...
|
|
|
|
|
At the button click event in form2 use
objfrm3=new frm3();
objfrm3.MdiParent=this.MdiParent;//Assigns Parent of frm2 as parent of frm3
objfrm3.Show();
and regarding your problem of multiple forms opening
use a counter to count no of instances of form and before instantiating check the value of the counter
|
|
|
|
|
Is it possible to use Cache in a windows form application? if yes, how do i do that? pls advice...
|
|
|
|
|
Sure. But the methods used depend entirely on what your trying to cache.
RageInTheMachine9532
|
|
|
|
|
Basically values from the database that has been stored into a hashtable... this hashtable will then later be inserted into a cache... i have tried doing it in asp.net by using System.Web; using System.Web.Caching to enable the use of Cache. so now i m actually wondering whether this could be used in a windows form application. can a windows form application call to this cache...?
|
|
|
|
|
|
You could use the Web.Caching class to do what you want.
If your app isn't web based, you might also want to look at this MSDN .NET Caching Guide[^] for some other ideas.
RageInTheMachine9532
|
|
|
|
|
Yeah the application that i m doing isn't web based...
For web based, i implemented something like this...
// Global Declaration
private Cache m_Cache;
// Constructor
m_Cache = HttpRuntime.Cache;
// The implementation
if ( m_Cache["Sql"] == null )
{
/*
1. Get Data To Be Cached From Database Into A DataSet
2. Insert DataSet To HashTable
3. Insert HashTable to m_Cache
*/
}
else
{
/*
Get The Required HashTable From Cache
*/
}
But then for my Windows Forms Application ( Isn't Web Based ), i wanna do it something like how i did it with the HttpRuntime.Cache but then i can't coz i don't wanna use Web.Caching Class. I know that by using Hashtable is already a form of caching, but how do i initialize a Hashtable for a runtime cache? i mean something like this...
// Global Declaration
private Hashtable m_Hashtable;
// Constructor
m_Hashtable = HttpRuntime.Cache; // Which is impossible coz i m not using Web.Caching Class.
Pls Advice...
|
|
|
|
|
Hi,
I want to hide the scroll bar of Panel without giving autoscroll property "false". I scroll that Panel from the other button's event by using win32 api. If I set autoscroll property to "false", panel cannot scroll. I don't want to see the scrollbar in Panel, but I want scroll Panel. How do I do?
Regards,
|
|
|
|
|
I'd recommend not using autoscroll ability. Instead, handle scrolling yourself, use vertical and horizontal scrollbar controls.
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
Does anyone have any examples of using C# to communicate with a RS232 device much like the MSComm component that is included in VB6?
|
|
|
|
|
|
I need to know how to retrieve the path of an image that is a picture box for a program that I am building. Any points in the right direction would be greatly appreciated.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
Since a PictureBox only displays an image passed to it through it's Image property, there is no way to ask the PictureBox where it came from. This would have to come from the Image object that is passed to the PictureBox. This could either be a Bitmap object or a Metafile object. In either case, neither exposes a property to see what the source file is. If your setting the Image property thru code, you should already have the filename stored in a variable when you created the Bitmap object to pass to PictureBox.
Now, I know what your thinking. You can set the Image property of a PictureBox in design mode. True, but the image is then stored in the executable as a resource when your project is compiled. The original filename isn't stored as part of the executable, but is stored in the project source files, inacessible to the running executable.
RageInTheMachine9532
|
|
|
|
|
the .NET app saves the image inf in resourse files,
I don't know how to retrieve the path but you can save the image in specified using
PictureBox.Image.Save(....
|
|
|
|