Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Proper Way To Determine AM or PM Pin
perlmunger5-Jan-04 17:16
perlmunger5-Jan-04 17:16 
GeneralPractice - Simple COM Interfaces Pin
Tristan Rhodes5-Jan-04 11:43
Tristan Rhodes5-Jan-04 11:43 
GeneralRe: Practice - Simple COM Interfaces Pin
Heath Stewart5-Jan-04 13:40
protectorHeath Stewart5-Jan-04 13:40 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 1:13
Tristan Rhodes6-Jan-04 1:13 
GeneralRe: Practice - Simple COM Interfaces Pin
Heath Stewart6-Jan-04 2:21
protectorHeath Stewart6-Jan-04 2:21 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 2:32
Tristan Rhodes6-Jan-04 2:32 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 3:01
Tristan Rhodes6-Jan-04 3:01 
Generalif files exist continue else exit Pin
Leon Radley5-Jan-04 11:03
Leon Radley5-Jan-04 11:03 
I'm down a little program that shows image sequences and I'm having a hard time with error handling, i have an xml settings file that i first want to load and when that has loaded and only if it has been successfull do I want the program to continue so heres the code at it's current state.

but it doesn't seem to be picking up if the file really exists or not, and I usually get a nullrefrence exeption, so how's the best way to check if the file exists?


private bool readXML()
{
bool returnValue;
doc = new XmlDocument();
if(File.Exists(xmlSettings))
{
doc.Load(xmlSettings);

nodeReader = new XmlNodeReader(doc);
nodeReader.MoveToContent();

title = nodeReader.GetAttribute("title");
name = nodeReader.GetAttribute("name");
totalframes = Convert.ToInt32(nodeReader.GetAttribute("totalframes"))-1;
rotate = Convert.ToInt32(nodeReader.GetAttribute("rotate"));
reverse = Convert.ToBoolean(nodeReader.GetAttribute("reverse"));
autoplay = Convert.ToBoolean(nodeReader.GetAttribute("autoplay"));
play_ms = Convert.ToInt32(nodeReader.GetAttribute("playms"));
autoresume = Convert.ToBoolean(nodeReader.GetAttribute("autoresume"));
autoresume_ms = Convert.ToInt32(nodeReader.GetAttribute("autoresumems"));
if (nodeReader != null)
{
nodeReader.Close();
}
returnValue = true;
}
else
{
// If any errors are found Exit Application
DialogResult result;
result = MessageBox.Show(this, "\nError: settings.xml Missing!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if(result == DialogResult.OK)
{
Application.Exit();
}
returnValue = false;
}
return returnValue;
}
GeneralRe: if files exist continue else exit Pin
Nick Parker5-Jan-04 12:54
protectorNick Parker5-Jan-04 12:54 
GeneralRe: if files exist continue else exit Pin
Leon Radley5-Jan-04 19:30
Leon Radley5-Jan-04 19:30 
GeneralRe: if files exist continue else exit Pin
Nick Parker6-Jan-04 12:56
protectorNick Parker6-Jan-04 12:56 
GeneralRe: if files exist continue else exit Pin
Niels Penneman7-Jan-04 9:10
Niels Penneman7-Jan-04 9:10 
General.NET & MSN Messenger 6.1 Pin
Niels Penneman5-Jan-04 10:27
Niels Penneman5-Jan-04 10:27 
GeneralRe: .NET & MSN Messenger 6.1 Pin
eggie56-Jan-04 13:31
eggie56-Jan-04 13:31 
GeneralGDI Layers Pin
Heroz5-Jan-04 8:30
Heroz5-Jan-04 8:30 
GeneralRe: GDI Layers Pin
Heroz5-Jan-04 9:50
Heroz5-Jan-04 9:50 
GeneralRe: GDI Layers Pin
Heath Stewart5-Jan-04 9:57
protectorHeath Stewart5-Jan-04 9:57 
Questionstarting other apps? Pin
Peter Reiter5-Jan-04 6:54
Peter Reiter5-Jan-04 6:54 
AnswerRe: starting other apps? Pin
Guillermo Rivero5-Jan-04 7:07
Guillermo Rivero5-Jan-04 7:07 
AnswerRe: starting other apps? Pin
Heath Stewart5-Jan-04 7:15
protectorHeath Stewart5-Jan-04 7:15 
GeneralRe: starting other apps? Pin
Guillermo Rivero5-Jan-04 7:22
Guillermo Rivero5-Jan-04 7:22 
QuestionBest code for this multithreading issue? Pin
profoundwhispers5-Jan-04 6:32
profoundwhispers5-Jan-04 6:32 
AnswerRe: Best code for this multithreading issue? Pin
HAHAHA_NEXT5-Jan-04 7:22
HAHAHA_NEXT5-Jan-04 7:22 
AnswerRe: Best code for this multithreading issue? Pin
Heath Stewart5-Jan-04 7:28
protectorHeath Stewart5-Jan-04 7:28 
Generalcustom save/open file dialog Pin
misterbear5-Jan-04 6:31
misterbear5-Jan-04 6:31 

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.