Click here to Skip to main content
16,017,502 members
Home / Discussions / C#
   

C#

 
AnswerRe: draw a box on screen Pin
ArunkumarSundaravelu6-Aug-07 5:22
ArunkumarSundaravelu6-Aug-07 5:22 
QuestionProperties Window [modified] Pin
sniper474-Aug-07 21:22
sniper474-Aug-07 21:22 
AnswerRe: Properties Window Pin
Hessam Jalali4-Aug-07 22:36
Hessam Jalali4-Aug-07 22:36 
GeneralRe: Properties Window Pin
sniper475-Aug-07 0:31
sniper475-Aug-07 0:31 
GeneralRe: Properties Window Pin
J. Dunlap5-Aug-07 8:48
J. Dunlap5-Aug-07 8:48 
QuestionC# error " not all code paths return a value" Pin
jayarajmrj4-Aug-07 19:36
jayarajmrj4-Aug-07 19:36 
AnswerRe: C# error " not all code paths return a value" Pin
Hessam Jalali4-Aug-07 21:27
Hessam Jalali4-Aug-07 21:27 
NewsRe: C# error " not all code paths return a value" Pin
javajohn5-Aug-07 5:42
javajohn5-Aug-07 5:42 
The return value of your method is a string, which requires that all exit points from your method provide a value to satisfy the compiler. The following example derived from yours is marked up to show the exit points...
public string SomeMethod(string fileName)
{
string strGetFile = "";
try
{
strGetFile = "some file name";
...
return strGetFile; //==> your optional exit point
}
catch
{
strGetFile = "";
...
return strGetFile; //==> your optional exit point
}
return strGetFile; //==> the main and only required exit point
}

Another way to handle it is to use only one exit point (this makes it easier to maintain as typically multiple exit points generally result in an increase in software maintenance costs over time)...

public string SomeMethod(string fileName)
{
string strGetFile = "";
try
{
strGetFile = "some file name";
...
//ensure the string is set and simply leave the try
}
catch
{
strGetFile = ""; //or some error message
...
//ensure the string is set and simply leave the catch
}
//execution resumes here after the try/catch block
return strGetFile; //==> the main and only required exit point
}


John
Questionmasterpage Pin
TAREQ F ABUZUHRI4-Aug-07 12:23
TAREQ F ABUZUHRI4-Aug-07 12:23 
AnswerRe: masterpage Pin
Paul Conrad4-Aug-07 12:53
professionalPaul Conrad4-Aug-07 12:53 
GeneralRe: masterpage Pin
Paul Conrad4-Aug-07 13:08
professionalPaul Conrad4-Aug-07 13:08 
GeneralRe: masterpage Pin
Malcolm Smart4-Aug-07 13:09
Malcolm Smart4-Aug-07 13:09 
GeneralRe: masterpage Pin
Paul Conrad4-Aug-07 13:15
professionalPaul Conrad4-Aug-07 13:15 
QuestionArraylist mystery Pin
zuidgeest4-Aug-07 9:41
zuidgeest4-Aug-07 9:41 
AnswerRe: Arraylist mystery Pin
Guffa4-Aug-07 13:19
Guffa4-Aug-07 13:19 
GeneralRe: Arraylist mystery Pin
zuidgeest5-Aug-07 5:27
zuidgeest5-Aug-07 5:27 
Questionget page name Pin
TAREQ F ABUZUHRI4-Aug-07 9:27
TAREQ F ABUZUHRI4-Aug-07 9:27 
AnswerRe: get page name Pin
Luc Pattyn4-Aug-07 9:41
sitebuilderLuc Pattyn4-Aug-07 9:41 
GeneralRe: get page name Pin
Urs Enzler4-Aug-07 23:19
Urs Enzler4-Aug-07 23:19 
AnswerRe: get page name Pin
Hessam Jalali4-Aug-07 23:37
Hessam Jalali4-Aug-07 23:37 
GeneralRe: get page name Pin
TAREQ F ABUZUHRI5-Aug-07 4:58
TAREQ F ABUZUHRI5-Aug-07 4:58 
AnswerRe: get page name Pin
Hessam Jalali5-Aug-07 5:33
Hessam Jalali5-Aug-07 5:33 
QuestionHow to submit form? Pin
VahagnSC4-Aug-07 8:43
VahagnSC4-Aug-07 8:43 
AnswerRe: How to submit form? Pin
Hessam Jalali4-Aug-07 21:54
Hessam Jalali4-Aug-07 21:54 
QuestionChanges table in database and transfer to dataset Pin
sgeorgije4-Aug-07 7:20
sgeorgije4-Aug-07 7:20 

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.