Click here to Skip to main content
15,894,410 members
Home / Discussions / C#
   

C#

 
GeneralRe: rotating a winform control Pin
The Cake of Deceit23-Jul-08 8:04
The Cake of Deceit23-Jul-08 8:04 
QuestionPlease help with xml reading Pin
Medp3722-Jul-08 18:42
Medp3722-Jul-08 18:42 
AnswerRe: Please help with xml reading Pin
Srishti Mathur22-Jul-08 19:14
Srishti Mathur22-Jul-08 19:14 
QuestionThread problem Pin
Mogaambo22-Jul-08 18:36
Mogaambo22-Jul-08 18:36 
AnswerRe: Thread problem Pin
Elroy Dsilva22-Jul-08 22:04
Elroy Dsilva22-Jul-08 22:04 
QuestionMy sort of first program that doesn't work Pin
DFlat4Now22-Jul-08 17:38
DFlat4Now22-Jul-08 17:38 
AnswerRe: My sort of first program that doesn't work Pin
John Ad22-Jul-08 20:31
John Ad22-Jul-08 20:31 
AnswerRe: My sort of first program that doesn't work Pin
mark_w_22-Jul-08 22:17
mark_w_22-Jul-08 22:17 
Right you are almost there!! lets just look at the function you are talking about

public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer;
Console.WriteLine("4 * 5 should equal: {0}", four * five);
four*five
return answer;
}


It will always return false as it stands, because you are declaring answer but not setting it, then returning it. By default it will be set to false.

All you need to do is set it, so something like this (this is done freehand so may not compile)

public bool TrueOrFalse()
{
int four = 4;
int five = 5;
bool answer = false; // always good practice to set the default :)
Console.WriteLine("4 * 5 should equal: {0}", four * five);
if((four*five) == 20)
{
answer=true;
}
//no need for an else as answer is preset to false at the declaration

return answer;
}


Hope that helps and its what you wanted
Questionparent form --> MDIChild connection Pin
shadowhazard22-Jul-08 17:32
shadowhazard22-Jul-08 17:32 
AnswerRe: parent form --> MDIChild connection Pin
Mbah Dhaim22-Jul-08 23:24
Mbah Dhaim22-Jul-08 23:24 
QuestionHard Inheritance Questions (for me) Pin
Dirso22-Jul-08 12:53
Dirso22-Jul-08 12:53 
AnswerRe: Hard Inheritance Questions (for me) Pin
Luc Pattyn22-Jul-08 13:26
sitebuilderLuc Pattyn22-Jul-08 13:26 
AnswerRe: Hard Inheritance Questions (for me) Pin
PIEBALDconsult22-Jul-08 14:32
mvePIEBALDconsult22-Jul-08 14:32 
AnswerRe: Hard Inheritance Questions (for me) Pin
Dirso22-Jul-08 16:34
Dirso22-Jul-08 16:34 
AnswerRe: Hard Inheritance Questions (for me) Pin
Giorgi Dalakishvili22-Jul-08 21:32
mentorGiorgi Dalakishvili22-Jul-08 21:32 
GeneralRe: Hard Inheritance Questions (for me) Pin
Dirso23-Jul-08 3:50
Dirso23-Jul-08 3:50 
GeneralRe: Hard Inheritance Questions (for me) Pin
Giorgi Dalakishvili23-Jul-08 4:44
mentorGiorgi Dalakishvili23-Jul-08 4:44 
QuestionLockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 12:39
gigahertz20522-Jul-08 12:39 
AnswerRe: Lockbits and 8-bit grayscale images Pin
Guffa22-Jul-08 13:39
Guffa22-Jul-08 13:39 
GeneralRe: Lockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 15:26
gigahertz20522-Jul-08 15:26 
GeneralRe: Lockbits and 8-bit grayscale images Pin
Luc Pattyn22-Jul-08 15:42
sitebuilderLuc Pattyn22-Jul-08 15:42 
GeneralRe: Lockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 15:50
gigahertz20522-Jul-08 15:50 
GeneralRe: Lockbits and 8-bit grayscale images Pin
Guffa23-Jul-08 4:33
Guffa23-Jul-08 4:33 
QuestionOpen (or focus) forms from listbox items Pin
nelsonpaixao22-Jul-08 12:34
nelsonpaixao22-Jul-08 12:34 
AnswerRe: Open (or focus) forms from listbox items Pin
Luc Pattyn22-Jul-08 13:29
sitebuilderLuc Pattyn22-Jul-08 13:29 

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.