Click here to Skip to main content
15,891,253 members
Home / Discussions / C#
   

C#

 
GeneralRe: gettin some error @ run time Pin
ankitjain111026-Aug-09 0:58
ankitjain111026-Aug-09 0:58 
Questiondeploy shared assembly with application during setup Pin
Abdul Rahman Hamidy25-Aug-09 23:56
Abdul Rahman Hamidy25-Aug-09 23:56 
AnswerRe: deploy shared assembly with application during setup Pin
Keith Barrow26-Aug-09 0:29
professionalKeith Barrow26-Aug-09 0:29 
GeneralRe: deploy shared assembly with application during setup Pin
Abdul Rahman Hamidy26-Aug-09 1:04
Abdul Rahman Hamidy26-Aug-09 1:04 
QuestionC# Beginner needs help. Pin
LighthouseCall25-Aug-09 23:26
LighthouseCall25-Aug-09 23:26 
AnswerRe: C# Beginner needs help. Pin
stancrm25-Aug-09 23:36
stancrm25-Aug-09 23:36 
AnswerRe: C# Beginner needs help. Pin
benjymous25-Aug-09 23:36
benjymous25-Aug-09 23:36 
AnswerRe: C# Beginner needs help. Pin
Luc Pattyn25-Aug-09 23:42
sitebuilderLuc Pattyn25-Aug-09 23:42 
Hi,

welcome to CodeProject.

your post is OK, it is in the right place; no one is going to move or delete it, even when fully answered.
and neither should you, according to these guidelines[^]. The one thing you forgot to do is apply PRE tags to improve readability of your code snippet.

Your code shows two errors, you should take the error messages literally, they say "hey, here is a string and you want to treat it as an integer, I can't do that". And yes, that is what is going on as Console.ReadLine() returns a string, and you want to store it in an int.

This is a beginner's mistake; changing some type into some other type most often needs an explicit conversion; that could be either a cast (on inheritance up/downcasting), a call to a method of the Convert class (seldom really useful), or a call to a method of the destination's type class (most often).

So what you want here is int.Parse() with an explicit try-catch construct, or better yet int.TryPatse() Look those up in the MSDN documentation, make google your friend!

And if you aren't familiar with any of this, I strongly recommend buying and studying a book on C#. Here is
why[^].

Cheers.

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

AnswerRe: C# Beginner needs help. Pin
kKamel26-Aug-09 0:02
kKamel26-Aug-09 0:02 
AnswerRe: C# Beginner needs help. Pin
Luc Pattyn26-Aug-09 0:24
sitebuilderLuc Pattyn26-Aug-09 0:24 
AnswerRe: C# Beginner needs help. Pin
DaveyM6926-Aug-09 0:28
professionalDaveyM6926-Aug-09 0:28 
AnswerRe: C# Beginner needs help. Pin
LighthouseCall26-Aug-09 3:32
LighthouseCall26-Aug-09 3:32 
QuestionAppending byte array to a byte array Pin
deep725-Aug-09 23:21
deep725-Aug-09 23:21 
AnswerRe: Appending byte array to a byte array Pin
stancrm25-Aug-09 23:25
stancrm25-Aug-09 23:25 
GeneralRe: Appending byte array to a byte array Pin
deep727-Aug-09 2:12
deep727-Aug-09 2:12 
AnswerRe: Appending byte array to a byte array Pin
Hristo-Bojilov25-Aug-09 23:43
Hristo-Bojilov25-Aug-09 23:43 
AnswerRe: Appending byte array to a byte array Pin
DaveyM6926-Aug-09 0:01
professionalDaveyM6926-Aug-09 0:01 
AnswerRe: Appending byte array to a byte array [modified] Pin
DaveyM6926-Aug-09 2:32
professionalDaveyM6926-Aug-09 2:32 
GeneralRe: Appending byte array to a byte array Pin
deep727-Aug-09 2:15
deep727-Aug-09 2:15 
QuestionHow to navigate inside a folder from picture to picture Pin
kKamel25-Aug-09 23:15
kKamel25-Aug-09 23:15 
AnswerRe: How to navigate inside a folder from picture to picture Pin
OriginalGriff25-Aug-09 23:27
mveOriginalGriff25-Aug-09 23:27 
GeneralRe: How to navigate inside a folder from picture to picture Pin
kKamel25-Aug-09 23:42
kKamel25-Aug-09 23:42 
GeneralRe: How to navigate inside a folder from picture to picture Pin
OriginalGriff25-Aug-09 23:55
mveOriginalGriff25-Aug-09 23:55 
AnswerRe: How to navigate inside a folder from picture to picture Pin
stancrm25-Aug-09 23:34
stancrm25-Aug-09 23:34 
AnswerRe: How to navigate inside a folder from picture to picture Pin
Saksida Bojan25-Aug-09 23:42
Saksida Bojan25-Aug-09 23:42 

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.