Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
AnswerRe: Win7 FolderBrowser on ext. Dev doesn't work Pin
dusty_dex15-May-13 0:27
dusty_dex15-May-13 0:27 
GeneralMethod Not Returning a Value Pin
N8tiv14-May-13 19:34
N8tiv14-May-13 19:34 
AnswerRe: Method Not Returning a Value Pin
parths14-May-13 20:05
parths14-May-13 20:05 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan14-May-13 21:24
mveRichard MacCutchan14-May-13 21:24 
GeneralRe: Method Not Returning a Value Pin
N8tiv15-May-13 20:29
N8tiv15-May-13 20:29 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan15-May-13 21:46
mveRichard MacCutchan15-May-13 21:46 
GeneralRe: Method Not Returning a Value Pin
N8tiv15-May-13 23:10
N8tiv15-May-13 23:10 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan16-May-13 1:17
mveRichard MacCutchan16-May-13 1:17 
You are still making those recursive calls to your AcceptValuexxx methods within the methods themselves. This is wrong, and will lead to either incorrect results or program crashes. You also do not need two methods, which do exactly the same thing. Try without the check for a valid number first, and ensure you enter a valid number in your tests, thus your method would be something like:
C#
Display the message
Read the input string
Convert the string to the integer value
Return the integer value

and in main() you would have:
C#
int valueOne = AcceptValue("gimme value one";
int valueTwo = AcceptValue("gimme value two";

That will get your basic code working, you can then add the extra checks later.

The link I gave you to Charles Petzold's book contains samples that show this in much greater detail than I have given here. I would suggest you work through that book, which will give you a good grounding in how the pieces all fit together.
Use the best guess

GeneralRe: Method Not Returning a Value Pin
N8tiv16-May-13 4:27
N8tiv16-May-13 4:27 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan16-May-13 5:02
mveRichard MacCutchan16-May-13 5:02 
GeneralRe: Method Not Returning a Value Pin
N8tiv16-May-13 6:13
N8tiv16-May-13 6:13 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan16-May-13 6:46
mveRichard MacCutchan16-May-13 6:46 
GeneralRe: Method Not Returning a Value Pin
N8tiv16-May-13 7:42
N8tiv16-May-13 7:42 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan16-May-13 20:40
mveRichard MacCutchan16-May-13 20:40 
GeneralRe: Method Not Returning a Value Pin
N8tiv17-May-13 11:31
N8tiv17-May-13 11:31 
GeneralRe: Method Not Returning a Value Pin
Richard MacCutchan17-May-13 22:50
mveRichard MacCutchan17-May-13 22:50 
GeneralRe: Method Not Returning a Value Pin
Pete O'Hanlon14-May-13 23:07
mvePete O'Hanlon14-May-13 23:07 
GeneralRe: Method Not Returning a Value Pin
N8tiv15-May-13 20:37
N8tiv15-May-13 20:37 
GeneralRe: Method Not Returning a Value Pin
Pete O'Hanlon15-May-13 23:50
mvePete O'Hanlon15-May-13 23:50 
GeneralRe: Method Not Returning a Value Pin
N8tiv16-May-13 0:29
N8tiv16-May-13 0:29 
GeneralRe: Method Not Returning a Value Pin
Pete O'Hanlon16-May-13 0:36
mvePete O'Hanlon16-May-13 0:36 
QuestionCreating Images on Different Layers Pin
ASPnoob14-May-13 11:40
ASPnoob14-May-13 11:40 
AnswerRe: Creating Images on Different Layers Pin
Ravi Bhavnani14-May-13 11:48
professionalRavi Bhavnani14-May-13 11:48 
AnswerRe: Creating Images on Different Layers Pin
SledgeHammer0114-May-13 12:51
SledgeHammer0114-May-13 12:51 
QuestionC# how save form in pdf/ and about calendar Pin
ghost22th14-May-13 4:39
ghost22th14-May-13 4:39 

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.