C# help pls....!!!

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2009
Posts: 27
Reputation: john_beginner is an unknown quantity at this point 
Solved Threads: 0
john_beginner john_beginner is offline Offline
Light Poster

C# help pls....!!!

 
0
  #1
Jul 4th, 2009
hello every one...

i'm very new to c#

in the following program (Console application prg.)

i want to get "int" value

of "eno","ph_no" in place of string type


but i don't know how to convert string type to "int"

type

if i use like

eno=(int)console.readLine();

then it will give error like "implicit conversion error"

i have search so many web site but i can't get proper answer

so please help me to solve it out

  1.  
  2. using System;
  3.  
  4. class emp
  5. {
  6. string ename,eno,ph_no;
  7. //int eno,ph_no;
  8.  
  9. public void get_data()
  10. {
  11.  
  12.  
  13. Console.WriteLine("\n\nEnter Employee Number :");
  14. eno = Console.ReadLine();//want int value ???
  15. Console.WriteLine("\nEnter The Employee Name: ");
  16. ename = Console.ReadLine();
  17. Console.WriteLine("\nEnter The Employee Ph. No: ");
  18. ph_no = Console.ReadLine();//want int value ??
  19.  
  20. }
  21.  
  22. public void put_data()
  23. {
  24. Console.WriteLine("---------------------------------------------");
  25. Console.WriteLine("OUT PUT IS");
  26. Console.WriteLine("---------------------------------------------");
  27. Console.WriteLine("\nEnter Employee Number : "+eno );
  28. Console.WriteLine("\nEnter The Employee Name : "+ename );
  29. Console.WriteLine("\nEnter The Employee Ph. No: "+ph_no );
  30.  
  31. }
  32.  
  33. }
  34.  
  35. public class big
  36. {
  37. public static void Main()
  38. {
  39.  
  40. emp obj= new emp();
  41.  
  42. obj.get_data();
  43. obj.put_data();
  44. }
  45.  
  46. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,917
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: C# help pls....!!!

 
0
  #2
Jul 4th, 2009
You have several options here :
If eno is an int then:
eno = Convert.ToInt32(Console.ReadLine());
or
eno = int.Parse(Console.ReadLine());
or
bool succes = int.TryParse(Console.ReadLine(), out eno);
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 27
Reputation: john_beginner is an unknown quantity at this point 
Solved Threads: 0
john_beginner john_beginner is offline Offline
Light Poster

Re: C# help pls....!!!

 
0
  #3
Jul 4th, 2009
@ddanbe

thank you so much.

whould u pls tell me which web site should i prefer for

" learning of c#"


Originally Posted by ddanbe View Post
You have several options here :
If eno is an int then:
eno = Convert.ToInt32(Console.ReadLine());
or
eno = int.Parse(Console.ReadLine());
or
bool succes = int.TryParse(Console.ReadLine(), out eno);
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,917
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: C# help pls....!!!

 
0
  #4
Jul 4th, 2009
There are several, but they tend to be focused on older versions. Just Google!
This one is rather good : http://www.functionx.com/csharp/index.htm
I recommend to download Visual Studio Express 2008 C#.(free!) VS has a starting page with links to videos and other learning info.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC