![]() |
|
[.NET] [VB] Basic Menu System [CONSOLE] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [VB] Basic Menu System [CONSOLE] (/showthread.php?tid=4473430) |
[VB] Basic Menu System [CONSOLE] - PatientZero - Oct 3, 2014 Hello Everyone, I have decided to throw this code together so you can use it in your own console programs. The menu is VERY basic and can be worked to look a lot better. The menu system works by having a list of options which can be selected with a number. After you have typed in the number and pressed enter it is then saved to a variable which is then called to display the option chosen. Like I said it is was a VERY basic project and can be improved if you wish. Screenshots of It Working: Default Page: ![]() For Option 1 - 3: ![]() ChangeLog: ![]() Authors: ![]() The Code: Code Module Module1* - TheBarret - Oct 3, 2014 Code choice = Console.ReadLine()This does not make sense to me, you waiting for a single key input not a line. Now once you change that to Char you can also change this: Code Select Case char- B * - PatientZero - Oct 3, 2014 (Oct 3, 2014 09:17 AM)TheBarret Wrote: That is very true indeed, This is just the way I have decided to program in VB Console since Day 1. * - Zettabit - Oct 3, 2014 (Oct 3, 2014 09:17 AM)TheBarret Wrote: How is he waiting for a "single key"? He's not using .ReadKey(), .ReadLine() is different. ReadLine: http://msdn.microsoft.com/en-us/library/system.console.readline(v=vs.110).aspx ReadKey: http://msdn.microsoft.com/en-us/library/system.console.readkey(v=vs.110).aspx * - xMoD - Oct 3, 2014 (Oct 3, 2014 05:41 PM)Zettabit Wrote: How is he waiting for a "single key"? He's not using .ReadKey(), .ReadLine() is different. Thats what hes saying. Hes asking why wait for a return, instead why not use .ReadKey(). See OP's code: choice = Console.ReadLine() TheBarret says to use Console.Readkey(). Simple. * - Zettabit - Oct 3, 2014 (Oct 3, 2014 05:55 PM)xMoD Wrote: Thats what hes saying. Ah, I misinterpreted his statement, my bad. It's been a long night... * - $lick - Oct 3, 2014 Code Sub Option2()This is useless, use a function. * - Odus - Oct 4, 2014 (Oct 3, 2014 09:53 PM)๖ۣۜLazy™ Wrote: This is useless, use a function. The entire thing is useless mate, not just that sub. 😏 * - TheBarret - Oct 4, 2014 (Oct 3, 2014 05:41 PM)Zettabit Wrote: How is he waiting for a "single key"? He's not using .ReadKey(), .ReadLine() is different. I dont think you understand what theire made for. let me rephrase that; He is waiting for a single char, wich the Console.ReadKey() is doing just that. he is using the Readline(). * - 420 Blaze It - Oct 4, 2014 Interesting, wouldnt it be esier to code it in batch? * - PatientZero - Oct 4, 2014 (Oct 4, 2014 04:56 AM)420 Blaze It Wrote: Interesting, wouldnt it be esier to code it in batch? Maybe, I just prefer VB and C++ than the rest 🤝 (Oct 4, 2014 04:55 AM)TheBarret Wrote: I dont think you understand what theire made for. Oh yes, I will use a ReadKey() instead next time :) Thanks for the feedback :D * - TheVBNetwork - Oct 5, 2014 (Oct 4, 2014 04:56 AM)420 Blaze It Wrote: Interesting, wouldnt it be esier to code it in batch? Well for 1, batch isn't a programming language its a script language and 2, batch is so limited because its not indented for for anything apart from core system functions. * - TheBarret - Oct 5, 2014 (Oct 5, 2014 09:31 AM)TheVBNetwork Wrote: Well for 1, batch isn't a programming language its a script language Hmmz well im about to raise my current project to a new level wich involves a script engine i development myself where i want to add the ability to create custom forms and what not. its pretty long project im working on but it resembles a syntax that is derived or better said influenced from C#, VB and Ruby. If your intrested, pm me about it ^^ |