|
|
The main method of a Windows Application:
static void Main(string[] args)<br />
{<br />
Application.EnableVisualStyles();<br />
Application.SetCompatibleTextRenderingDefault(false);<br />
<br />
try<br />
{ <br />
Application.Run(new MainForm()); <br />
}<br />
catch (Exception ex)<br />
{ <br />
MessageBox.Show("Caught exception in Main method.")<br />
}<br />
}
I've put the Run method inside a try-catch block.
When an exception is caught inside a method that belongs to the MainForm class, I throw that exception, expecting to see the MessageBox called from the Main method.
Things happen as expected when I run the program in debug mode form VS.
However, if I run the exe file directly from the Debug folder of my project, the program behaves differently, in the sense that the message box does not pop up anymore, and instead the much-hated "Unhandled exception has occured in your application." window shows.
The same happens if I generate a beep on the PC speaker(System.Console.Beep()) instead of showing the message box.
I really don't understand. Why is the exception caught only in Debug mode??
Thanks.
|
|
|
|
|
Did you check Wikipedia?
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
MicealG wrote: Did you check Wikipedia?
Dude don't take things personally
I think his intension was only for fun/kidding perpose
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi!
Although I don't understand why this behaviour is like it is in every detail, I think I can tell you how to get consistent behaviour in every case:
Add
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); before calling Application.Run(... and the corresponding event handler like this:
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
throw e.Exception;
}
Now every exception will be caught by your "top level" try/catch.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks. It does the trick, even though it's a little unorthodox.
PS: I like you signature.
|
|
|
|
|
hi all
while using reports...
in a table sum of one column will appear when there are values in the columns
when there are no values in the column #Error appears...
i wanna remove that #error and display some thing else
i am using aggregate function SUM in the footer...
thanks bye
|
|
|
|
|
Hey folks,
If someone could shed some light on this error message it would be great.
Error Message
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
No unhandled exception??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Can you narrow this done slightly, I'm staring at a lot of code?
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
Normally an application will catch an exception at the base level of the application and show a message to that effect before ending.
---
single minded; short sighted; long gone;
|
|
|
|
|
I added a try/catch/finally to the program.cs, do you think that this will help me capture the error?
Freedom is the right to say that 2+2=5 if this is so everything else will follow.
|
|
|
|
|
Hi!
I need an example that shows how it works a DataGridView with a SELECT statement.For example I have a comboBox with 4 tables(Oferte, Transport, Locatie, Rezervari) and the fields for Oferte(id_oferta, data_start, data_stop, etc.). When I select one of them from the comboBox I want so see the selected table fields in my DataGridView. I don't know how to do this, so if you could help me...thank you.
|
|
|
|
|
Try this.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I tried that code and it works but I don't understand exactly how it works. I need something else. I don't want to write the select statement in the form when compilling the program. I must select from the comboBox the wanted table and then it will apear in my dataGrid(and I supose that must be done with the select statement somewhere in the comboBox) . I'm a begginer in this language and I don't know very well how to use it.
Thank you for your example, Hlihor Vlad.
|
|
|
|
|
Hi!
i'm having a problem running an aplication that uses crystal reports on machines with .net framework 2.0 only..
to clarify.. i have a machine with winXP and .net framework 2.0 installed.. when i try to run an application (vs2005) in which i use Crystal Reports it crashes..
i tried copying CR dll's to the release directory but didn't work..
thanks for any help
life is study!!!
|
|
|
|
|
Hi
Re-install Crystal report component alone and try again ..
Harini
|
|
|
|
|
well.. to reinstall something i'd have to install it first..
my problem is that on target machine there is .net framework 2.0 only.. no CR..
btw. where can i find something to install CR on target machines?!
life is study!!!
|
|
|
|
|
Hello All,
I want to show an animated gif in DataGridViewImageCell or DataGridViewCell. When I use DataGridViewImageCell, gif image is shown as static. I tried to use my custom class derived from DataGridViewCell, but I can not define any timer object in my custom class. My image is a simple circle colored red or yellow blinking on a white background. I tried to use Graphics class to draw the the image but I could not get any solution.
Do you have any solution or comment about it?
Thanks,
Mert Kantarcioglu
|
|
|
|
|
Hi,
How to merge cells in datagridview?
|
|
|
|
|
Hi.
XSL is used to transform XML documents in a friendlier and more easily readable format, HTML.
Is it possible to save the generated HTML as a file on the disk?
Thanks.
|
|
|
|
|
Yes.
It is possible to do the XSL transformation into a Stream and then write that Stream to the disk using a StreamWriter
|
|
|
|
|
Thanks.
As i found out, with .NET 2.0 's XMLCompiledTransform class it's even easier:
XslCompiledTransform xslt = new XslCompiledTransform();<br />
xslt.Load("output.xsl");<br />
<br />
xslt.Transform("books.xml", "books.html");
|
|
|
|
|
Hello everyone,
I am currently using a TabControl in an Windows Application. I would like to have the same functionality as TabControl (Multi-Pages) so, I can have different pages with various functionalities (Buttons, DataGridView, and etc.) but I don't wish to have the "Tab" to change the pages. I would like to create the illusion that the entire page changed by simply cilcking the desired page from the Menu. Something similar to Outlook.
Can someone be kind enough to tell me what Control do I need to use to have this?
I hope I managed to make sence. Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
No built in control does this. You'd have to write, buy or find one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|