Click here to Skip to main content
15,906,625 members
Home / Discussions / C#
   

C#

 
QuestionFileStream question... again Pin
RussBus26-Jun-07 4:58
RussBus26-Jun-07 4:58 
AnswerRe: FileStream question... again Pin
Colin Angus Mackay26-Jun-07 5:07
Colin Angus Mackay26-Jun-07 5:07 
GeneralRe: FileStream question... again Pin
RussBus26-Jun-07 5:27
RussBus26-Jun-07 5:27 
GeneralRe: FileStream question... again Pin
Colin Angus Mackay26-Jun-07 5:30
Colin Angus Mackay26-Jun-07 5:30 
GeneralRe: FileStream question... again Pin
Dave Kreskowiak26-Jun-07 6:58
mveDave Kreskowiak26-Jun-07 6:58 
AnswerRe: FileStream question... again Pin
Luc Pattyn26-Jun-07 5:41
sitebuilderLuc Pattyn26-Jun-07 5:41 
GeneralRe: FileStream question... again Pin
RussBus26-Jun-07 5:48
RussBus26-Jun-07 5:48 
GeneralRe: FileStream question... again Pin
Luc Pattyn26-Jun-07 6:00
sitebuilderLuc Pattyn26-Jun-07 6:00 
That sounds simple enough:

1. on user open, first try open in Mode.readwrite, if that fails, try open in Mode.read
and alert user
2. on user save, try save the file, if that fails, try to "save as".

I dont see the problem. If coded correctly, a save never "crashes".

Things to keep in mind:
1. you need a try-catch for each operation that might fail (each try in above text)
2. dont carry any file state information from 1. (try to open) to 2. (try to save) since
there is no need to, and the state may have changed anyhow.
3. Dont forget to always Dispose() or Close() things that need it (such as FileStreams).

Smile | :)







GeneralRe: FileStream question... again Pin
RussBus26-Jun-07 6:39
RussBus26-Jun-07 6:39 
QuestionSocket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
haroon198026-Jun-07 4:37
haroon198026-Jun-07 4:37 
AnswerRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
Ed.Poore26-Jun-07 5:06
Ed.Poore26-Jun-07 5:06 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
haroon198026-Jun-07 5:10
haroon198026-Jun-07 5:10 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
Ed.Poore26-Jun-07 5:55
Ed.Poore26-Jun-07 5:55 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
haroon198026-Jun-07 5:59
haroon198026-Jun-07 5:59 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
Ed.Poore26-Jun-07 6:41
Ed.Poore26-Jun-07 6:41 
AnswerRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
led mike26-Jun-07 5:29
led mike26-Jun-07 5:29 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
haroon198026-Jun-07 5:36
haroon198026-Jun-07 5:36 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
led mike26-Jun-07 5:52
led mike26-Jun-07 5:52 
GeneralRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
haroon198026-Jun-07 5:54
haroon198026-Jun-07 5:54 
AnswerRe: Socket Exception:{"An existing connection was forcibly closed by the remote host"} Pin
LongRange.Shooter26-Jun-07 9:52
LongRange.Shooter26-Jun-07 9:52 
GeneralRe: How to implement a syntax checker using C# ? Pin
I.explore.code26-Jun-07 3:58
I.explore.code26-Jun-07 3:58 
Questionmy previous button is working as a next button Pin
srinivassam26-Jun-07 3:50
srinivassam26-Jun-07 3:50 
AnswerRe: my previous button is working as a next button Pin
Luc Pattyn26-Jun-07 4:24
sitebuilderLuc Pattyn26-Jun-07 4:24 
QuestionExists() method of System.Collections.Generic.List Pin
lossy26-Jun-07 3:28
lossy26-Jun-07 3:28 
AnswerRe: Exists() method of System.Collections.Generic.List Pin
Giorgi Dalakishvili26-Jun-07 3:38
mentorGiorgi Dalakishvili26-Jun-07 3:38 

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.