Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
AnswerRe: PreviewWord Pin
Mohamad Al Husseiny12-Sep-05 10:18
Mohamad Al Husseiny12-Sep-05 10:18 
QuestionIActiveDesktop Pin
Anonymous12-Sep-05 2:48
Anonymous12-Sep-05 2:48 
AnswerRe: IActiveDesktop Pin
Mohamad Al Husseiny12-Sep-05 10:14
Mohamad Al Husseiny12-Sep-05 10:14 
QuestionAccess create table from the app ... Pin
Sharpoverride12-Sep-05 2:45
Sharpoverride12-Sep-05 2:45 
AnswerRe: Access create table from the app ... Pin
Guffa12-Sep-05 3:09
Guffa12-Sep-05 3:09 
QuestionOpenFile and SaveFile dialogs change the current directory. Pin
Sharpoverride12-Sep-05 2:41
Sharpoverride12-Sep-05 2:41 
AnswerRe: OpenFile and SaveFile dialogs change the current directory. Pin
S. Senthil Kumar12-Sep-05 4:01
S. Senthil Kumar12-Sep-05 4:01 
AnswerRe: OpenFile and SaveFile dialogs change the current directory. Pin
Dave Kreskowiak12-Sep-05 5:52
mveDave Kreskowiak12-Sep-05 5:52 
Your code really shouldn't be depending on the current directory anyway. The general rule-of-thumb in programming is assume nothing!. What this means is you never assume that the file you want to access is in the current directory. Always use fully qualified path names and not just a filename when doing any kind of file access.

This also has other benefits. Say you put up a OpenFileDialog that changed the current directory. After the user picks a file, you try and put the current directory back to what it was. But, your code crashes, for whatever reason, before that can happen! The function ends up returning as failed, but not having restored the current directory. Now what? Your next file access is assuming (there's that word again Wink | ;) ) the current directory is correct when it's not, and your app ends up crashing a second time, then a third, forth, fifth, ...

Write your code so it defends itself against itself. Never assume anything is what you expect it to be.


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome


-- modified at 16:07 Monday 12th September, 2005
AnswerRe: OpenFile and SaveFile dialogs change the current directory. Pin
Large Data File13-Sep-05 22:14
Large Data File13-Sep-05 22:14 
Questionpinvoke a C++ struct to C# Pin
Thomas van Veen12-Sep-05 2:27
Thomas van Veen12-Sep-05 2:27 
AnswerRe: pinvoke a C++ struct to C# Pin
Andy Moore12-Sep-05 13:00
Andy Moore12-Sep-05 13:00 
Question[Message Deleted] Pin
sahithya harsha12-Sep-05 2:24
sahithya harsha12-Sep-05 2:24 
AnswerRe: help me plz.... Pin
Dave Kreskowiak12-Sep-05 6:02
mveDave Kreskowiak12-Sep-05 6:02 
General[Message Deleted] Pin
sahithya harsha12-Sep-05 13:42
sahithya harsha12-Sep-05 13:42 
GeneralRe: help me plz.... Pin
Dave Kreskowiak12-Sep-05 15:46
mveDave Kreskowiak12-Sep-05 15:46 
QuestionHi , Is there any way to Get HTTP Headers of a Page other then HttpWebRequest Pin
Tariq Rahim12-Sep-05 2:01
Tariq Rahim12-Sep-05 2:01 
AnswerRe: Hi , Is there any way to Get HTTP Headers of a Page other then HttpWebRequest Pin
Guffa12-Sep-05 3:40
Guffa12-Sep-05 3:40 
GeneralRe: Hi , Is there any way to Get HTTP Headers of a Page other then HttpWebRequest Pin
Tariq Rahim12-Sep-05 3:54
Tariq Rahim12-Sep-05 3:54 
QuestionUsing dll that built by VC++ in C# Pin
lucdt12-Sep-05 1:59
lucdt12-Sep-05 1:59 
QuestionReally capturing a window Pin
bluechipmunk12-Sep-05 0:51
bluechipmunk12-Sep-05 0:51 
AnswerRe: Really capturing a window Pin
Daniel Turini12-Sep-05 1:27
Daniel Turini12-Sep-05 1:27 
QuestionBasic Insert Please correct Pin
dabuskol12-Sep-05 0:19
dabuskol12-Sep-05 0:19 
AnswerRe: Basic Insert Please correct Pin
LeenaSo12-Sep-05 0:44
LeenaSo12-Sep-05 0:44 
AnswerRe: Basic Insert Please correct Pin
mav.northwind12-Sep-05 0:46
mav.northwind12-Sep-05 0:46 
QuestionDrawing an arc Pin
11-Sep-05 23:52
suss11-Sep-05 23:52 

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.