Hi @Eugene Gough ,
If you do want to display 'Console.Write' in WinForm, then you can refer to the following steps.
Create a Module :
Imports System.Runtime.InteropServices
Module Program
<DllImport("kernel32.dll")>
Private Function AttachConsole(ByVal dwProcessId As Integer) As Boolean
End Function
Private Const ATTACH_PARENT_PROCESS As Integer = -1
Sub main()
AttachConsole(ATTACH_PARENT_PROCESS)
Application.Run(New Form1())
End Sub
End Module
Then in 'Project Properties' > Application , set 'Startup object' to 'Sub Main' and 'Application type' to 'Console Application', finally un-check the 'Enable application framework' check box.
Code in button1:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Console.Write("Here I am! ")
Console.WriteLine("Hello World!")
Console.WriteLine("Enter Password: ")
Dim name As String = Console.ReadLine()
TextBox1.Text = name
End Sub
Result of my test:
Hope it could be helpful.
Best Regards,
Xingyu Zhao
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.