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

C#

 
AnswerMessage Closed Pin
12-Mar-10 10:15
stancrm12-Mar-10 10:15 
GeneralRe: Floating child form linked to Treemap nodes [modified] Pin
boreland12-Mar-10 10:32
boreland12-Mar-10 10:32 
GeneralRe: Floating child form linked to Treemap nodes Pin
Dave Kreskowiak12-Mar-10 11:13
mveDave Kreskowiak12-Mar-10 11:13 
AnswerRe: Floating child form linked to Treemap nodes Pin
Luc Pattyn12-Mar-10 11:04
sitebuilderLuc Pattyn12-Mar-10 11:04 
GeneralRe: Floating child form linked to Treemap nodes Pin
boreland12-Mar-10 11:09
boreland12-Mar-10 11:09 
Questionabout remote desktop(noel) Pin
v_neil8712-Mar-10 8:54
v_neil8712-Mar-10 8:54 
QuestionHelp with C# Pin
Janded12-Mar-10 0:15
Janded12-Mar-10 0:15 
AnswerRe: Help with C# Pin
OriginalGriff12-Mar-10 0:59
mveOriginalGriff12-Mar-10 0:59 
Janded wrote:
I am having problem setting up the variables. Do I have to store the age, pincode and numbers in int ?


You don't have to, you can store them in a string, which is how they come in from the user. However, if you what to do useful comparisons, then you do indeed need to convert them to int, long or similar.
The code below should give you the basics: Prompt, read in, convert, and show again.
class Program
   {
   static void Main(string[] args)
      {
      Console.WriteLine("Enter your age:");
      string userAge = Console.ReadLine();
      int age;
      if (int.TryParse(userAge, out age))
         {
         Console.WriteLine("In ten years you will be {0}", age + 10);
         }
      else
         {
         Console.WriteLine("{0} is not a number!", userAge);
         }
      }
   }
The TryParse examines a string and attempts to convert it to an int (in this case, long, double etc. are all available). There is also Parse, but that will throw an exception if the user enters "Hello" when you want a number. TryParse doesn't - it just returns false.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

GeneralRe: Help with C# Pin
riced12-Mar-10 4:42
riced12-Mar-10 4:42 
GeneralRe: Help with C# Pin
OriginalGriff12-Mar-10 4:53
mveOriginalGriff12-Mar-10 4:53 
GeneralUnivoter strikes! Pin
OriginalGriff12-Mar-10 5:35
mveOriginalGriff12-Mar-10 5:35 
GeneralRe: Univoter strikes! Pin
harold aptroot12-Mar-10 8:11
harold aptroot12-Mar-10 8:11 
GeneralRe: Univoter strikes! Pin
riced12-Mar-10 13:31
riced12-Mar-10 13:31 
GeneralRe: Univoter strikes! Pin
OriginalGriff12-Mar-10 21:59
mveOriginalGriff12-Mar-10 21:59 
AnswerRe: Help with C# Pin
The Man from U.N.C.L.E.12-Mar-10 8:21
The Man from U.N.C.L.E.12-Mar-10 8:21 
GeneralMessage Removed Pin
13-Mar-10 4:03
Janded13-Mar-10 4:03 
GeneralRe: Help with C# Pin
The Man from U.N.C.L.E.14-Mar-10 23:40
The Man from U.N.C.L.E.14-Mar-10 23:40 
GeneralRe: Help with C# Pin
Janded19-Mar-10 1:42
Janded19-Mar-10 1:42 
GeneralRe: Help with C# Pin
Janded19-Mar-10 2:04
Janded19-Mar-10 2:04 
GeneralRe: Help with C# Pin
The Man from U.N.C.L.E.19-Mar-10 2:20
The Man from U.N.C.L.E.19-Mar-10 2:20 
GeneralRe: Help with C# Pin
Janded20-Mar-10 2:42
Janded20-Mar-10 2:42 
GeneralRe: Help with C# Pin
Janded20-Mar-10 2:57
Janded20-Mar-10 2:57 
Questionwrite to app.config through c# Pin
prasadbuddhika11-Mar-10 22:47
prasadbuddhika11-Mar-10 22:47 
AnswerRe: write to app.config through c# Pin
Estys11-Mar-10 23:36
Estys11-Mar-10 23:36 
QuestionSerial Port Pin
Deepak.Prahlad11-Mar-10 22:14
Deepak.Prahlad11-Mar-10 22:14 

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.