C
C#2y ago
maroonlol

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
Ezlanding
Ezlanding2y ago
You’re typing in 1-?
maroonlol
maroonlol2y ago
I dont exactly follow
Ezlanding
Ezlanding2y ago
What are you typing in that causes the issue?
maroonlol
maroonlol2y ago
This is my menu
maroonlol
maroonlol2y ago
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
Ezlanding
Ezlanding2y ago
It’s not an issue with visual studio
maroonlol
maroonlol2y ago
Oh okay thank you so do you know what the issue can be
Ezlanding
Ezlanding2y ago
First, what are you typing in the terminal the causes that error?
maroonlol
maroonlol2y ago
1 That is the option
Ezlanding
Ezlanding2y ago
@Abdul Raheem Nazir set a string to the result of the Console.ReadLine() and tell me what it is/see if it is numeric
maroonlol
maroonlol2y ago
It gives me a input but when I type a digit is stops and breaks and doesnt run the code after
maroonlol
maroonlol2y ago
This is the change I made
Ezlanding
Ezlanding2y ago
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
MODiX
MODiX2y ago
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/
maroonlol
maroonlol2y ago
BlazeBin - zizaiavuzcay
A tool for sharing your source code with the world!
Ezlanding
Ezlanding2y ago
I don’t have time to test it now, but the error you get should only be from typing in a non-numeric string
MasterSubarashii
you are probably getting error because of putting an integer be vary of " " and don't use ' ' it means it wants a char variable
MasterSubarashii
yeah you are probably good to go by changing those ' ' to " "
MasterSubarashii
and change the char variable to string
Want results from more Discord servers?
Add your server
More Posts