| | |
C# help pls....!!!
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2009
Posts: 27
Reputation:
Solved Threads: 0
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
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
.cs Syntax (Toggle Plain Text)
using System; class emp { string ename,eno,ph_no; //int eno,ph_no; public void get_data() { Console.WriteLine("\n\nEnter Employee Number :"); eno = Console.ReadLine();//want int value ??? Console.WriteLine("\nEnter The Employee Name: "); ename = Console.ReadLine(); Console.WriteLine("\nEnter The Employee Ph. No: "); ph_no = Console.ReadLine();//want int value ?? } public void put_data() { Console.WriteLine("---------------------------------------------"); Console.WriteLine("OUT PUT IS"); Console.WriteLine("---------------------------------------------"); Console.WriteLine("\nEnter Employee Number : "+eno ); Console.WriteLine("\nEnter The Employee Name : "+ename ); Console.WriteLine("\nEnter The Employee Ph. No: "+ph_no ); } } public class big { public static void Main() { emp obj= new emp(); obj.get_data(); obj.put_data(); } }
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);
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
Make love, no war. Cave ab homine unius libri.
Danny
•
•
Join Date: Mar 2009
Posts: 27
Reputation:
Solved Threads: 0
@ddanbe
thank you so much.
whould u pls tell me which web site should i prefer for
" learning of c#"
thank you so much.
whould u pls tell me which web site should i prefer for
" learning of c#"
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.
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
Make love, no war. Cave ab homine unius libri.
Danny
![]() |
Similar Threads
- windows xp installation error!! pls help! (Troubleshooting Dead Machines)
- Help me remove Online Poker Pop up pls (Viruses, Spyware and other Nasties)
- hi friends pls help me out (C++)
- pls.help me im begging you!!! (C)
- pls... i need help!!! (C)
- Pls Hlp me with Hijackthis log file. (Viruses, Spyware and other Nasties)
- Pls help with my HJT log (Viruses, Spyware and other Nasties)
- can somebody pls. help me out with my HJT log.. (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: Use of List<int[]>
- Next Thread: noob question
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop php picturebox pixelinversion post programming radians regex remoting resourcefile richtextbox server sleep socket sql statistics stream string study system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






