Click here to Skip to main content
15,892,797 members
Home / Discussions / C#
   

C#

 
GeneralSet the Coordinate Pin
kamalesh574325-Mar-08 20:11
kamalesh574325-Mar-08 20:11 
GeneralRe: Set the Coordinate Pin
Vasudevan Deepak Kumar25-Mar-08 20:21
Vasudevan Deepak Kumar25-Mar-08 20:21 
GeneralAccessing Win32 windows handles/pointers from a C# application/form Pin
pinhigh2k25-Mar-08 16:40
pinhigh2k25-Mar-08 16:40 
GeneralRe: Accessing Win32 windows handles/pointers from a C# application/form Pin
Christian Graus25-Mar-08 17:52
protectorChristian Graus25-Mar-08 17:52 
GeneralPreventing TextChanged Event... Pin
teachtech25-Mar-08 13:32
teachtech25-Mar-08 13:32 
GeneralRe: Preventing TextChanged Event... Pin
AB777125-Mar-08 14:59
AB777125-Mar-08 14:59 
GeneralRe: Preventing TextChanged Event... Pin
Abhijit Jana25-Mar-08 19:16
professionalAbhijit Jana25-Mar-08 19:16 
GeneralNeed help with handling exception Pin
TheJudeDude25-Mar-08 12:53
TheJudeDude25-Mar-08 12:53 
I have this assignment m_strFileName = OpenFile(); in which there is a try/catch block within the OpenFile method.

 private string OpenFile()<br />
		{<br />
			string strFilename;          	<br />
<br />
			if (intStoreNumber == 201)<br />
			{<br />
				strFilename = "t1";<br />
			}<br />
			else if (intStoreNumber == 202)<br />
			{<br />
				strFilename = "t2";<br />
			}<br />
			else if (intStoreNumber == 203)<br />
			{<br />
				strFilename = "T3";<br />
			}<br />
			else<br />
			{<br />
				strFilename = intStoreNumber.ToString();<br />
				strFilename = strFilename.PadLeft(2,'0');<br />
			}<br />
<br />
					<br />
			strFilename = "afford" + strFilename + ".dat";<br />
			try<br />
			{<br />
				File.Copy("F:\\BORIS\\" + strFilename, Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\" + strFilename,true);<br />
			}<br />
			catch <br />
			{<br />
				MessageBox.Show("The file " + strFilename + " can not be found. Please check " +  <br />
					"that you selected the correct store and that your network connection to" +  <br />
					" drive F: is not disconnected","File Not Found", MessageBoxButtons.OK,<br />
					MessageBoxIcon.Exclamation);<br />
				<br />
			}<br />
				strFilename = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\" +  strFilename;<br />
				return strFilename;


The question I have is if the program runs into this exception, how do I return it back to waiting on an event versus going through to the next method?

Everything I got from google tells me all about the structure of a try/catch/finally block, but nothing much more on how to exit gracefully without shutting down the program.

Thanx in advance.

Jude

GeneralRe: Need help with handling exception Pin
AB777125-Mar-08 15:04
AB777125-Mar-08 15:04 
GeneralRe: Need help with handling exception Pin
TheJudeDude25-Mar-08 16:26
TheJudeDude25-Mar-08 16:26 
GeneralRe: Need help with handling exception Pin
AB777125-Mar-08 17:31
AB777125-Mar-08 17:31 
GeneralRe: Need help with handling exception Pin
TheJudeDude25-Mar-08 17:50
TheJudeDude25-Mar-08 17:50 
GeneralRe: Need help with handling exception Pin
TheJudeDude25-Mar-08 18:00
TheJudeDude25-Mar-08 18:00 
GeneralRe: Need help with handling exception Pin
AB777125-Mar-08 18:04
AB777125-Mar-08 18:04 
GeneralRe: Need help with handling exception Pin
TheJudeDude25-Mar-08 18:32
TheJudeDude25-Mar-08 18:32 
QuestionSMS through CellPhone? Pin
NewToAspDotNet25-Mar-08 10:38
NewToAspDotNet25-Mar-08 10:38 
AnswerRe: SMS through CellPhone? Pin
Giorgi Dalakishvili25-Mar-08 11:05
mentorGiorgi Dalakishvili25-Mar-08 11:05 
AnswerRe: SMS through CellPhone? Pin
led mike25-Mar-08 11:06
led mike25-Mar-08 11:06 
AnswerRe: SMS through CellPhone? Pin
Vasudevan Deepak Kumar25-Mar-08 20:20
Vasudevan Deepak Kumar25-Mar-08 20:20 
GeneralAfter the Restoration of a DB with Stored Procedures are not recognised Pin
Vimalsoft(Pty) Ltd25-Mar-08 10:23
professionalVimalsoft(Pty) Ltd25-Mar-08 10:23 
GeneralRe: After the Restoration of a DB with Stored Procedures are not recognised Pin
Not Active25-Mar-08 10:29
mentorNot Active25-Mar-08 10:29 
GeneralRe: After the Restoration of a DB with Stored Procedures are not recognised Pin
Vimalsoft(Pty) Ltd25-Mar-08 11:25
professionalVimalsoft(Pty) Ltd25-Mar-08 11:25 
GeneralRe: After the Restoration of a DB with Stored Procedures are not recognised Pin
Christian Graus25-Mar-08 11:45
protectorChristian Graus25-Mar-08 11:45 
GeneralRe: After the Restoration of a DB with Stored Procedures are not recognised Pin
Vimalsoft(Pty) Ltd25-Mar-08 20:42
professionalVimalsoft(Pty) Ltd25-Mar-08 20:42 
GeneralCreate Rule in runtime mode Pin
cocoonwls25-Mar-08 8:41
cocoonwls25-Mar-08 8:41 

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.