gpt4 book ai didi

vb.net - 如何在VB中打开控制台

转载 作者:行者123 更新时间:2023-12-02 11:38:56 24 4
gpt4 key购买 nike

我目前有一个console application使用下图所示的设置。但是现在我希望使用 console 打开多个表单所以我想知道是否可以以某种方式打开多个表单或打开 consoleWindows Forms Application

Here is the Project's settings

最佳答案

@tinstaafl can you share this extra programming or a link to a solution. Thanks

这里有几个链接:

Console and WinForm together for easy debugging

Console Enhancements

这是第一个的转换。您需要一个复选框名称为“CheckBox1”的表单:

Imports System.Runtime.InteropServices

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
Win32.AllocConsole()
Console.WriteLine("Done!")
Else
Win32.FreeConsole()
End If
End Sub
End Class
Public Class Win32
<DllImport("kernel32.dll")> Public Shared Function AllocConsole() As Boolean

End Function
<DllImport("kernel32.dll")> Public Shared Function FreeConsole() As Boolean

End Function

End Class

每次单击该复选框时,您都会显示或隐藏控制台。您可以像任何控制台应用程序一样写入和读取。

关于vb.net - 如何在VB中打开控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21055166/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com