Click here to Skip to main content
15,886,110 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWhen to close streamreaders/writers Pin
Marcus J. Smith22-Feb-07 3:12
professionalMarcus J. Smith22-Feb-07 3:12 
AnswerRe: When to close streamreaders/writers Pin
Dave Kreskowiak22-Feb-07 5:05
mveDave Kreskowiak22-Feb-07 5:05 
GeneralRe: When to close streamreaders/writers Pin
Marcus J. Smith22-Feb-07 5:21
professionalMarcus J. Smith22-Feb-07 5:21 
GeneralRe: When to close streamreaders/writers Pin
Dave Kreskowiak22-Feb-07 5:25
mveDave Kreskowiak22-Feb-07 5:25 
GeneralRe: When to close streamreaders/writers Pin
Marcus J. Smith22-Feb-07 5:28
professionalMarcus J. Smith22-Feb-07 5:28 
GeneralRe: When to close streamreaders/writers Pin
Dave Kreskowiak22-Feb-07 5:56
mveDave Kreskowiak22-Feb-07 5:56 
GeneralRe: When to close streamreaders/writers Pin
Marcus J. Smith22-Feb-07 6:13
professionalMarcus J. Smith22-Feb-07 6:13 
GeneralRe: When to close streamreaders/writers Pin
Dave Kreskowiak22-Feb-07 6:28
mveDave Kreskowiak22-Feb-07 6:28 
cleako wrote:
You're saying there is a performance hit to open the file everytime you need to write to it or to open 5 and write if you need to when you need to until you are done and then closing them all?


Yes, there is a performance penalty for opening and closing a file. Try it. Write a little app that opens a file, writes 10,000 lines of text to it, then closes it. Then rewrite that loop so it opens the file, writes a line to it, then closes it, 10,000 times. See which one runs faster.


cleako wrote:
checking for nothing establishes if it is ok to Flush and Close?


You're checking to see if it is safe to call Flush and Close, and even Dispose, on that object. If that object is Nothing, then any call you make on it will result in a Null Reference Exception.


cleako wrote:
are you saying I could simply call .Dispose and it would take care of the Flush/Close instead of me calling those 2 in addition to the .Dispose?


Yep.


Dave Kreskowiak
Microsoft MVP - Visual Basic


QuestionRAR Pin
Navneet Hegde22-Feb-07 1:22
Navneet Hegde22-Feb-07 1:22 
AnswerRe: RAR Pin
Dave Kreskowiak22-Feb-07 3:17
mveDave Kreskowiak22-Feb-07 3:17 
QuestionSetup Project won't build/re-build Pin
HamCoder22-Feb-07 0:52
HamCoder22-Feb-07 0:52 
AnswerRe: Setup Project won't build/re-build Pin
Johan Hakkesteegt22-Feb-07 21:07
Johan Hakkesteegt22-Feb-07 21:07 
QuestionPInvoke Imbalance Stack function Pin
sundar_mca22-Feb-07 0:39
sundar_mca22-Feb-07 0:39 
AnswerRe: PInvoke Imbalance Stack function Pin
Guffa22-Feb-07 0:54
Guffa22-Feb-07 0:54 
GeneralRe: PInvoke Imbalance Stack function Pin
sundar_mca22-Feb-07 1:24
sundar_mca22-Feb-07 1:24 
GeneralRe: PInvoke Imbalance Stack function Pin
Dave Kreskowiak22-Feb-07 3:16
mveDave Kreskowiak22-Feb-07 3:16 
QuestionExport DatagridView to Excel Pin
Socheat.Net21-Feb-07 22:40
Socheat.Net21-Feb-07 22:40 
AnswerRe: Export DatagridView to Excel Pin
Dave Kreskowiak22-Feb-07 4:44
mveDave Kreskowiak22-Feb-07 4:44 
QuestionSet a column in datagrid to display a time. Pin
kendo1721-Feb-07 22:04
kendo1721-Feb-07 22:04 
AnswerRe: Set a column in datagrid to display a time. Pin
Christian Graus21-Feb-07 23:00
protectorChristian Graus21-Feb-07 23:00 
QuestionHow I add referense to? Pin
Agbaria Ahmad21-Feb-07 21:25
Agbaria Ahmad21-Feb-07 21:25 
AnswerRe: How I add referense to? Pin
teejayem27-Feb-07 15:16
teejayem27-Feb-07 15:16 
QuestionRemote port communication Pin
shreekar21-Feb-07 20:45
shreekar21-Feb-07 20:45 
AnswerRe: Remote port communication Pin
Dave Kreskowiak22-Feb-07 3:11
mveDave Kreskowiak22-Feb-07 3:11 
Questionchecking for a substring Pin
ArchaBhandare21-Feb-07 20:19
ArchaBhandare21-Feb-07 20:19 

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.