VB.Net by API/System/Console

Материал из VB Эксперт
Перейти к: навигация, поиск

Console.BackgroundColor

<source lang="vbnet"> Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.Clear()

<source lang="vbnet"> Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.ForegroundColor

<source lang="vbnet"> Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.LargestWindowHeight

<source lang="vbnet"> Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.ReadKey

<source lang="vbnet"> Module Module1

   Sub Main()
       Dim strChar As String
       Console.Write("Enter a character: ")
       strChar = Console.ReadKey.KeyChar
       "strChar = Console.ReadKey(True).KeyChar
       Console.WriteLine()
       Console.WriteLine("You just entered {0}.", strChar)
   End Sub

End Module


 </source>


Console.ReadKey.KeyChar

<source lang="vbnet"> Module Module1

   Sub Main()
       Dim strChar As String
       Console.Write("Enter a character: ")
       strChar = Console.ReadKey.KeyChar
       "strChar = Console.ReadKey(True).KeyChar
       Console.WriteLine()
       Console.WriteLine("You just entered {0}.", strChar)
   End Sub

End Module


 </source>


Console.ReadLine()

<source lang="vbnet"> Module Module1

   Sub Main()
       Dim strMessage As String
       Try
           strMessage = Console.ReadLine()
           Console.WriteLine("HELLO " + strMessage)
       Catch ex As Exception
       End Try
   End Sub

End Module


 </source>


Console.Title

<source lang="vbnet"> Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.WindowHeight

<source lang="vbnet">

Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.WindowWidth

<source lang="vbnet"> Module Module1

   Sub Main()
       
       Console.Title = "Custom Command Window"
       Console.BackgroundColor = ConsoleColor.White
       Console.ForegroundColor = ConsoleColor.DarkBlue
       Console.WindowHeight = Console.LargestWindowHeight - 15
       Console.WindowWidth = Console.LargestWindowWidth - 15
       "Call a few methods to clear and pause the window.
       Console.Clear()
   End Sub

End Module


 </source>


Console.WriteLine

<source lang="vbnet"> Imports System public class MainClass

   Shared Sub Main()
        Dim twelve As Integer = 12
        Dim five As Integer = 5
        Console.WriteLine("{0} + {1} = {2}", _
            twelve, five, twelve + five)
        Console.WriteLine("{0} - {1} = {2}", _
            twelve, five, twelve - five)
        Console.WriteLine("{0} * {1} = {2}", _
            twelve, five, twelve * five)
   End Sub

End Class


 </source>