Click here to Skip to main content
15,893,668 members
Home / Discussions / C#
   

C#

 
Questionhow to find the word present in the document Pin
ayyp10-Aug-06 2:08
ayyp10-Aug-06 2:08 
AnswerRe: how to find the word present in the document Pin
Not Active10-Aug-06 3:26
mentorNot Active10-Aug-06 3:26 
GeneralRe: how to find the word present in the document Pin
ayyp10-Aug-06 19:07
ayyp10-Aug-06 19:07 
GeneralRe: how to find the word present in the document Pin
Khalid Sabtan3-Jul-12 12:15
Khalid Sabtan3-Jul-12 12:15 
Questiongracefull exit Pin
Glen Harvy10-Aug-06 1:59
Glen Harvy10-Aug-06 1:59 
AnswerRe: gracefull exit Pin
Not Active10-Aug-06 2:52
mentorNot Active10-Aug-06 2:52 
AnswerRe: gracefull exit Pin
Stefan Troschuetz10-Aug-06 2:54
Stefan Troschuetz10-Aug-06 2:54 
GeneralRe: gracefull exit Pin
Glen Harvy10-Aug-06 12:30
Glen Harvy10-Aug-06 12:30 
Thanks for your response:

Stefan Troschütz wrote:

What does that mean exactly? Are you getting any exception?


After the program makes the test and exits (see below) I get ->

The error is:
Microsoft .Net Framework
Unhandled Exception has occured in your application ...
Could not find file ......

I then click Quit and get a further message saying that "Program has encountered a problem and needs to close ....

Stefan Troschütz wrote:
When do you call startupCheck?


program.cs contains

    static void Main()<br />
    {<br />
      Application.EnableVisualStyles();<br />
      Application.SetCompatibleTextRenderingDefault(false);<br />
      Application.Run(new MainForm());<br />
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />
When debugging this is where the debugger goes after the call to Application.Exit()<br />
<br />
    }


and MainForm.cs contains (in part) ->

bool startupCheckValue = true;<br />
// check for existence of necessary files and directories<br />
startupCheckValue = startupCheck();<br />
if (startupCheckValue == false)<br />
{<br />
  Application.Exit();<br />
}


and ..

private bool startupCheck()<br />
{<br />
  // make sure database file exists<br />
  bool dataBaseExists;<br />
  dataBaseExists = File.Exists(@".\Resources\myclub.mdb");<br />
  if (dataBaseExists == false)<br />
  {<br />
    MessageBox.Show("The database file is missing from the Resource Directory.\nPlease install database file and start program again", "WARNING - CRUCIAL FILE MISSING", MessageBoxButtons.OK, MessageBoxIcon.Stop);<br />
    return false;<br />
  }<br />
  return true; <br />
}


I've changed the code a bit as a result of the other suggestions made (and well appreciated I might add Smile | :) ) but my original problem still exists Hmmm | :| .

I think the Application.Exit() is being called at the wrong place however I don't see where else it would go as it's imediately before where the program will spit the dummy anyhow because of the missing file.

Regards,


Glen Harvy

GeneralRe: gracefull exit Pin
Stefan Troschuetz10-Aug-06 22:16
Stefan Troschuetz10-Aug-06 22:16 
AnswerRe: gracefull exit Pin
Ennis Ray Lynch, Jr.10-Aug-06 4:15
Ennis Ray Lynch, Jr.10-Aug-06 4:15 
GeneralRe: gracefull exit Pin
Glen Harvy10-Aug-06 12:36
Glen Harvy10-Aug-06 12:36 
AnswerRe: gracefull exit Pin
likefood10-Aug-06 9:41
likefood10-Aug-06 9:41 
QuestionSOAP Attachments - c# and java Pin
teluksridhar10-Aug-06 1:18
teluksridhar10-Aug-06 1:18 
QuestionDebugging SP with Sql server 2005. Pin
Ankit_748110-Aug-06 1:12
Ankit_748110-Aug-06 1:12 
QuestionExternal function Pin
thepersonof10-Aug-06 1:06
thepersonof10-Aug-06 1:06 
AnswerRe: External function Pin
Andrei Ungureanu10-Aug-06 2:49
Andrei Ungureanu10-Aug-06 2:49 
GeneralRe: External function Pin
thepersonof10-Aug-06 10:13
thepersonof10-Aug-06 10:13 
QuestionCrystalReportViewer is slow Pin
atuldeore10-Aug-06 0:19
atuldeore10-Aug-06 0:19 
Questionwhat is the formula.... Pin
diddy3410-Aug-06 0:09
diddy3410-Aug-06 0:09 
AnswerRe: what is the formula.... Pin
Guffa10-Aug-06 2:53
Guffa10-Aug-06 2:53 
QuestionChanging display area in ListView Pin
Flow849-Aug-06 23:57
Flow849-Aug-06 23:57 
AnswerRe: Changing display area in ListView Pin
VSush10-Aug-06 0:40
VSush10-Aug-06 0:40 
GeneralRe: Changing display area in ListView Pin
Flow8410-Aug-06 0:59
Flow8410-Aug-06 0:59 
GeneralRe: Changing display area in ListView Pin
Flow8414-Aug-06 11:48
Flow8414-Aug-06 11:48 
AnswerRe: Changing display area in ListView Pin
Flow8416-Aug-06 10:21
Flow8416-Aug-06 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.