Click here to Skip to main content
15,908,842 members
Home / Discussions / C#
   

C#

 
QuestionNeed help with drag and drop panel Pin
Pathetic Logic14-Apr-08 21:04
Pathetic Logic14-Apr-08 21:04 
GeneralRe: Need help with drag and drop panel Pin
dan!sh 14-Apr-08 21:25
professional dan!sh 14-Apr-08 21:25 
QuestionRe: Need help with drag and drop panel Pin
Pathetic Logic14-Apr-08 22:42
Pathetic Logic14-Apr-08 22:42 
Generalimage in report Pin
laleh.rajabi14-Apr-08 20:57
laleh.rajabi14-Apr-08 20:57 
GeneralRe: image in report Pin
Ravenet14-Apr-08 21:56
Ravenet14-Apr-08 21:56 
GeneralFile creation and Thread Abort Pin
Kashif Iqbal Khan14-Apr-08 20:53
Kashif Iqbal Khan14-Apr-08 20:53 
GeneralRe: File creation and Thread Abort Pin
Christian Graus14-Apr-08 21:15
protectorChristian Graus14-Apr-08 21:15 
GeneralRe: File creation and Thread Abort Pin
Kashif Iqbal Khan14-Apr-08 22:36
Kashif Iqbal Khan14-Apr-08 22:36 
I have not tried using block. The reason is streamWriter is an instance field and the stream is closed after all the text written to the file (which is in different instance methods).

However, I have added a finally block which closes the streamWriter when not null. following is a code:


<br />
try<br />
{<br />
	.<br />
	.<br />
	.<br />
	// Stream is initialized in the following method call<br />
	this.generator.GenerateFile(outputFileName);<br />
	.<br />
	.<br />
	.<br />
}<br />
catch(Exception exc)<br />
{<br />
	LogError(exc);<br />
	Log("File Generation failed.");<br />
}<br />
finally<br />
{	<br />
	this.generator.CloseStream();<br />
}<br />
<br />


Following is the CloseStream(). Seems like streamWriter remains null.

<br />
<br />
internal void CloseStream()<br />
{<br />
	if(streamWriter != null)<br />
	{<br />
		try<br />
		{<br />
			streamWriter.Flush();<br />
		}<br />
		catch<br />
		{<br />
		}<br />
		try<br />
		{<br />
			streamWriter.Close();<br />
		}<br />
		catch<br />
		{<br />
		}<br />
		streamWriter = null;<br />
	}<br />
}<br />
<br />

GeneralRe: File creation and Thread Abort Pin
Daniel Grunwald14-Apr-08 22:47
Daniel Grunwald14-Apr-08 22:47 
QuestionHow can I look for ASCII values in my DataGrid Pin
Walaza14-Apr-08 20:26
Walaza14-Apr-08 20:26 
AnswerRe: How can I look for ASCII values in my DataGrid Pin
Christian Graus14-Apr-08 21:16
protectorChristian Graus14-Apr-08 21:16 
GeneralRe: How can I look for ASCII values in my DataGrid Pin
Vikram A Punathambekar14-Apr-08 21:36
Vikram A Punathambekar14-Apr-08 21:36 
GeneralRe: How can I look for ASCII values in my DataGrid Pin
Walaza14-Apr-08 23:29
Walaza14-Apr-08 23:29 
GeneralRe: How can I look for ASCII values in my DataGrid Pin
Christian Graus15-Apr-08 0:01
protectorChristian Graus15-Apr-08 0:01 
GeneralRe: How can I look for ASCII values in my DataGrid Pin
Walaza15-Apr-08 1:54
Walaza15-Apr-08 1:54 
GeneralRe: How can I look for ASCII values in my DataGrid Pin
Christian Graus15-Apr-08 11:01
protectorChristian Graus15-Apr-08 11:01 
AnswerRe: How can I look for ASCII values in my DataGrid Pin
Ravenet14-Apr-08 21:58
Ravenet14-Apr-08 21:58 
QuestionHow can I check for ASCII values in my DataGrid Pin
Walaza14-Apr-08 20:19
Walaza14-Apr-08 20:19 
GeneralAuto Start Up Application When Window load up Pin
HatakeKaKaShi14-Apr-08 20:04
HatakeKaKaShi14-Apr-08 20:04 
GeneralRe: Auto Start Up Application When Window load up Pin
Vikram A Punathambekar14-Apr-08 20:26
Vikram A Punathambekar14-Apr-08 20:26 
AnswerRe: Auto Start Up Application When Window load up Pin
Arjun Marwaha14-Apr-08 20:29
Arjun Marwaha14-Apr-08 20:29 
GeneralRe: Auto Start Up Application When Window load up Pin
Ravenet14-Apr-08 22:00
Ravenet14-Apr-08 22:00 
QuestionHow can I write and Read Resource file in C# application? Pin
Member 400849214-Apr-08 19:40
Member 400849214-Apr-08 19:40 
AnswerRe: How can I write and Read Resource file in C# application? Pin
Christian Graus14-Apr-08 19:54
protectorChristian Graus14-Apr-08 19:54 
AnswerRe: How can I write and Read Resource file in C# application? Pin
Ravenet14-Apr-08 22:01
Ravenet14-Apr-08 22:01 

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.