Console ApplicationsThis is a featured page

This tutorial will show the basics of using a console application.


Create a new console application, file/new and within the main sub, add this code :

console.write("Exit Application(yes = y, No = n")
console.writeline()

If Console.ReadKey.Key = ConsoleKey.Y Then
Console.Write("You Responded Yes")

ElseIf Console.ReadKey.Key = ConsoleKey.N Then
Console.Write("You Responded No")

End If

This example shows how to get user input using the console.readkey function, as well as how to write to the console using console.write() and how to go to the next line using console.writline()

In this next example, I will show how to read text from the console, as well as how to make the application do something only when a certain word or string is entered into the console.

Create a new conosle application and add this sub below the main sub:

publicsub blueconsole()
(
console.backgroundcolor = consolecolor.blue
)


And add this code to the main sub:

dim consoletext as string

consoletext = console.readline()

If consoletext = "blue console" then
blueconsole()
End If



The code above defines a new variable called consoletext and it stores the value of the text from the current line of the console, then it checks if its text is equal to "blue console", and if it is it makes the console blue using the blueconsole function that you created.




Mrgameruler
Mrgameruler
Latest page update: made by Mrgameruler , May 5 2008, 4:31 PM EDT (about this update About This Update Mrgameruler Edited by Mrgameruler

216 words added

view changes

- complete history)
Keyword tags: application console tutorial vb
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)