I have a problem with running my code and I'm unsure if it is Visual Studio or my Code
In the screenshot it displays my menu. Then I type my option in (1- in this case). then my command promt closes and I get this error which I didn't got before I had put it in a Menu option. When I go back on the command promt it displays my question but doesn't allow me to enter my input and ends the code. Can anyone suggest to me why this happens, or if they need to see the full code to understand.
Thank you
20 Replies
You’re typing in
1-
?I dont exactly follow
What are you typing in that causes the issue?
This is my menu
I understand that when I type the option it leads to the error but it runs the code after that but doesn't give me and input
It’s not an issue with visual studio
Oh okay thank you so do you know what the issue can be
First, what are you typing in the terminal the causes that error?
1
That is the option
@Abdul Raheem Nazir set a string to the result of the
Console.ReadLine()
and tell me what it is/see if it is numericIt gives me a input but when I type a digit is stops and breaks and doesnt run the code after
This is the change I made
Change it back to console.ReadLine, I was suggesting that for testing purposes
The error your got should only happen if the input string isn’t numeric
Please upload your $code like this or on paste.mod.gg
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/BlazeBin - zizaiavuzcay
A tool for sharing your source code with the world!
I don’t have time to test it now, but the error you get should only be from typing in a non-numeric string
you are probably getting error because of putting an integer
be vary of " "
and don't use ' '
it means it wants a char variable
yeah you are probably good to go by changing those ' ' to " "
and change the char variable to string