|
Hey
What line causes the exception. And also have you tried doing the validation on form load, see if it still happens?
Let me know if it helps.
Thanks
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
You can put the verification either into the Load event handler of your form and do the Close() there, or just put the verification before all the Application.XXX calls in the Main method, this way the form will not be created at all.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Dirso,
You can put the validation code in your Main method, before you even instantiate your form.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
That would be the best solution, but I'd like some general solution that would work for Console Applications too.
for example, what If one of my funcional classes can't load because its configuration is missing or if some device is offline... First, I ask if the user wants to try again, but if it quits, I need to shut it down.
Thanks,
Dirso
|
|
|
|
|
Console apps have a Main method too A console app exits when you return from Main .
You could also add a reference to System.Windows.Forms if you want to show a message box or even a form. That would kind of subvert the console format, though.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Nick Butler wrote: Console apps have a Main method too Confused A console app exits when you return from Main.
I know... and I haven't thinking about moving my code to other methods than the construtors... I'll give it a try
thanks,
Dirso
|
|
|
|
|
Dirso wrote: public FrmGuardian()
{
if (!validInstall())
this.Close(); // here I tried Application.Exit and Application.ExitThread
using (FrmSplash splash = new FrmSplash())
Exit from the C'tor before executing the remaining code..
if (!validInstall())
{
this.Close();
return;
}
*jaans
|
|
|
|
|
|
As we already told you, you can do this in the Load event handler of your form.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, and it is a good idea. But I'd like something more general that could work on Console Applications too.
Thanks,
Dirso
|
|
|
|
|
What about the Main method then? Console applications also have a Main method.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You should do all of your form initialization in the FormLoad method, and call Application.Exit() from that method if needed.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hi,
i developed for a comercial application a quite complex gui framework based on forms, with windows manager and docking manager, where the forms could have various contents, from datagrids to media players.
it al works nice, except for one problem:
i have a main form (something like a mainframe) and a set of owned forms. suposing that the main application form is MainFrame, for all the owned forms, let's say Owned1, Owned2, etc. i set OwnedX.Owner = MainFrame.
the problem is that in some circumstancies my OwnedX forms end by being displayed, in the z-order, behind MainFrame form (i figured out that by making the MainFrame form semitransparent). when i click on either MainFrame form, or on any of the OwnedX that are still visible, everithing comes back to normal, and all the owned forms are displayed on top of the owner.
the problem is that even if MSDN states that a owned form couldn't be displayed before owner form, it happens. let me mention again that in my application i have multiple forms, with a very diversified content (up to 5 media players, using IVideoWindow component, datagrids, all kind of controls, from editboxes to buttons). what is specific to my forms is that they don't have a captionbar and a border, i emulate them using HT_XXX notifications, but i doubt that this is the problem as everithing works fine until something triggers abnormal behaviour, when a owned form goes behind owner form, and when the owner form is activated by clicking on it the owned forms is displayed back on top of the owner form.
i'm using visual studio 2005, .net framework 2.0 and windows xp with service pack 3 (it happened with service pack 2 too). i supose that is something in .net framework but, of course, i cannot tell where.
if anybody has an idea on what cause that, or encountered the same problem, please try to explain me where i do wrong.
best wishes, and thank you,
calin
|
|
|
|
|
Hard to say what is actually causing the owned forms to go behind the owner one. You could try handle the Deactivate event of one of your owned forms and see what the call stack looks like.
SkyWalker
|
|
|
|
|
hi,
i tried to handle activate, deactivate, set focus, focus lost, position changed (as much as possible without entering a infinte loop). no efect. the callstack, and also the messages seen with windows spy, looks ok. it is something ouside my code, most likely soemwhere deep in .net framework...
thank you,
calin
|
|
|
|
|
Hey
I need to detect when the content of the screen has changed i.e. a window has been opened or a tooltip pops up or basically any change from one snapshot of a screen to the next. The first way I have considered doing this is periodically taking a screen shot in code and then comparing the bitmaps for differences but this could lead to missing screen changes if my interval of snapshots is too large.
However this is inneficient and possibly very slow. Does any one know if there is some sort of OS event I can request notify me if the screen content changes and better yet which area of the screen has changed?
Although this is in the C# section pointers to any C++ resources would also be very helpful.
Thanks
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
|
Hey
Thanks for your help , that looks like a step in the right direction. The other method I have found just incase somebody is interested is here:
http://msdn.microsoft.com/en-us/library/ms644991(VS.85).aspx[^]
Sorry for the none .NET post but it looks like this method could be of help to anyone looking to do something similar to what I want.
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
Glad to help you
|
|
|
|
|
Hi,
I need to make a trend graph(dynamic datas) in my c# dotnet application. Could anyone help me.
|
|
|
|
|
Take a look at this article[^].
It's a great free charting library.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi All,
I have a CSV file with two Columns, the first Column has quotes and in between those quotes there is a comma, how do I make my application not read the comma in between the quotes but read the second data in the second column?
Please can you assist me please!!
Regards,
Ndeza
|
|
|
|
|
|
|
I want to retrieve all data members names (fields names) for my custom class and put those names in a list of strings. Is this possible?
Any example with source code would be highly appreciated!
Regards, matixsc.
|
|
|
|