✅ If i choose an option then i get nothing in the output
I have made an ticketsystem and you can use arrows to select an option but only the option exit works the first option and second option doesn´t work how can i fix this?
62 Replies
Code: https://paste.pythondiscord.com/CF6A
Json: https://paste.pythondiscord.com/ZW5Q
I hope someone can help me
!close
Closed!
what happens it when u chose either option it reaches Console.Clear(); so fast u dont see them showing up
by adding a console.readkey or some other mean u allow time to read it
u might want to rethink your logic so it stays on screen
they made a new thread :d
https://discord.com/channels/143867839282020352/1223327380987314266
okay
The code works now but if i run the code and press enter i get the ticketinformation while if i press p for example then i have the menu to choose which option i want
https://paste.pythondiscord.com/A3CA Code
https://paste.pythondiscord.com/Q4YQ Json
moment I will check your changes
Okay thank you
yeah that works too its similar to what I did didn't need to change the switch but yeah
Its weird if i press enter i get the ticketinformation while i have not chose for that while when i press p except p you can choose every pressbutton but only enter wont work to get in the menu i get the menu and then i can choose
let me see
because your default option is 1
so if u hit enter it enters the
if (keyInfo.Key == ConsoleKey.Enter)
u should probably reset the selectedoption to 3
and set it default to 3
or some other invalid option
so ti goes back to the menu
int selectedOption = 1;
so I hit enter it enters the if
and prints the option 1
so change it to 3
I assume if u choose 2
and then hit enter
it will show 2
oh
either change it to 3 or set selectoption to say -1
or 4
okay
and after it shows the option
set it back to 4 for example
which line
it is acutally me and my friend who are working on this system
inside your if !=3 and
where u declare/initialize selectedOption
line 83
anyway it will most likely mess up with your up/down arrow if u add an extra option
so u would have to handle that
or just add an extra option before exit saying go back to menu
and use that one as default
it doesnt work if i change it to 4 if i change it the menu is messing up
well u need to change your logic to account for the option 4
so I would move exit to 4
go to menu would be 3
then u have to increase your uparrow limit
ur for count
i need to press my up arrow to use an option of the menu
while down arrow is needed
yes but right now its limited to 3
if u now have a 4th option
then it needs to be a different number to limit dont u think
so would be if != 4 good
if i set line 83 to 4
that is not the only think u have to change
every other line that limits the options
needs to be changed
its so hard
why? u have 4 options before u had 3
all u need to do is change 3 to 4
but its not only on the if
there are other places
but do i need to change the if also to 4 the line 83
if u moved your exit to option 4 then yes
but i have 3 options in menu
didnt I just say add an option before exit that says go back to menu?!?!
but i only need 3 options they said not more
then you have to change your logic
it wont work anymore since 4 is needed
u still have your old code there
its weird that only enters gives the information but pressing something else not
because you wrote it so that when enter is pressed it checks the options to print
do you have an idea what i can change that will work good
is that navigation with up and down needed?
what is the actual requiriment
yes
it needs to be an menu with 3 options and there need to be an arrow to choose an option
because if I dont know the requirement then I wont be able to help and will most likely suggest things u can't use
this is it
ok so my suggestion is
remove this
and move this
before the
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
then it will enter the menu options with the arrow on option 1
so if they hit enter it makes sense it show the ticket informationit will start your app like this
do u understand what I am saying?
was that too confusing?
Wait can you show me in discord paste
I am a beginner in C# thats why it is confusing
u remove the lines that are inside the red square on the first image
u select all the lines that are in red on the second image copy it, then deleted it
then you paste it again before the line where it says
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
Okay
u should be able to do that much your self
It is confusing but now I understand
Now the selectoption can still be 1 right
Or should it still be 4
yes u dont have to change anythign else
Okay clear
can u $paste your file
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
to the site above so I cna see if u changed it right
Wait I can do it tomorrow im now not be able to have access on my laptop
I am on my phone
sure
Thanks man