Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   Getting Dynamic Input - IO.GetInt (http://www.go4expert.com/forums/getting-dynamic-input-iogetint-t5461/)

jagu_rita 25Jul2007 18:34

Getting Dynamic Input - IO.GetInt
 
:) Hai,

Simple Question.What is a another method to get input from user and convert string into integer(Int.Parse )?
If i am not wrong can we use IO.GetInt method?If i use that i couldnt get output.Can you please tell the way to do this?
Is there any possibility to get Dynamic Input?
Please i need some website names to search good C# tutorial.
Your reply would be appreciated.

(I hope i have posted in correct section.If not please move to desired place.)

-Rita.

shabbir 25Jul2007 20:23

Re: Getting Dynamic Input - IO.GetInt
 
System.Console.ReadLine

jagu_rita 25Jul2007 20:48

Re: Getting Dynamic Input - IO.GetInt
 
Quote:

Originally Posted by shabbir
System.Console.ReadLine

I hope It will be used to get the string value.How can i convert into integer?
I know one method of doing conversion from string to integer.
int i1=int.Parse(Console.ReadLine());

Do we have any other method to convert from string to integer in visual C#?
Thanks for your reply.

shabbir 25Jul2007 21:24

Re: Getting Dynamic Input - IO.GetInt
 
Why you don't want to be using the one method.

jagu_rita 25Jul2007 21:38

Re: Getting Dynamic Input - IO.GetInt
 
Quote:

Originally Posted by shabbir
Why you don't want to be using the one method.

Not like that.actually I heard in C# we have another method to convert from string to integer.so if you aware about that please tell me.Moreover i have an assignement in that topic.

It will be very helpful for me.And i have searched in the net.but i cant find out which method used to convert string to integer other than Parse?

Thanks.

shabbir 25Jul2007 21:57

Re: Getting Dynamic Input - IO.GetInt
 
One method could be the type casting one. Try a typecasting of an string into an integer and see what happens.

jagu_rita 26Jul2007 10:28

Re: Getting Dynamic Input - IO.GetInt
 
We can use Convert.ToInt32 method for conversion from string to Integer Number.
Some Examples :
int i1 = Convert.ToInt32(Console.ReadLine());
DateTime i2 = Convert.ToDateTime(Console.ReadLine());
decimal i3 = Convert.ToDecimal(Console.ReadLine());

jagu_rita 26Jul2007 10:32

Re: Getting Dynamic Input - IO.GetInt
 
We can use Convert.ToInt32 method for conversion from string to Integer Number.
Obvisouly We can use Int.Parse Method also.
Convert.ToInt32 is another Method to get input from user.
Some Examples :
int i1 = Convert.ToInt32(Console.ReadLine());
DateTime i2 = Convert.ToDateTime(Console.ReadLine());
decimal i3 = Convert.ToDecimal(Console.ReadLine());

Thanks.


All times are GMT +5.5. The time now is 01:21.