Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 如何打开控制台窗口?VB_Vb.net_Console_Basic - Fatal编程技术网

Vb.net 如何打开控制台窗口?VB

Vb.net 如何打开控制台窗口?VB,vb.net,console,basic,Vb.net,Console,Basic,我想让我的控制台窗口在Visual Basic中打开。用我的代码,我只能要求一行,然后窗口关闭。这是我的密码: Module Module1 Sub Main() If (Console.ReadLine = "e") Then Console.WriteLine("Test") End If Console.ReadKey() End Sub End Module 因此,当我运行此代码时,我可以键入“e”并按enter键。出现“测试”字样,然

我想让我的控制台窗口在Visual Basic中打开。用我的代码,我只能要求一行,然后窗口关闭。这是我的密码:

Module Module1

Sub Main()

    If (Console.ReadLine = "e") Then
        Console.WriteLine("Test")
    End If

    Console.ReadKey()

End Sub

End Module

因此,当我运行此代码时,我可以键入“e”并按enter键。出现“测试”字样,然后按下一个键后控制台关闭。但我想让它打开,直到我写下一个特殊的单词。

这里有一个愚蠢的例子:

Sub Main()
    Dim password As String = "007"

    Dim response As String
    Do
        Console.Write("Password: ")
        response = Console.ReadLine
        If response <> password Then
            Console.WriteLine("Incorrect Password!")
        End If
    Loop While response <> password

    Console.WriteLine("Welcome James Bond!")
    Console.Write("Press [Enter] to proceed...")
    Console.ReadLine()
End Sub
Sub-Main()
密码为String=“007”
作为字符串的暗淡响应
做
控制台。写入(“密码:”)
response=Console.ReadLine
如果是响应密码,则
Console.WriteLine(“密码不正确!”)
如果结束
响应密码时循环
Console.WriteLine(“欢迎詹姆斯·邦德!”)
控制台。写入(“按[Enter]继续…”)
Console.ReadLine()
端接头

谢谢您的回答。我希望它是怎样工作的!