Console.Write Not Working In Win Forms App

Posted by Steven on Stack Overflow See other posts from Stack Overflow or by Steven
Published on 2010-04-14T14:11:36Z Indexed on 2010/04/14 14:53 UTC
Read the original article Hit count: 297

Filed under:
|
|

I created a VB.NET Windows Forms Application in Visual Studio 2008. When I run my program from the command-line, I get no output (only the next prompt).

What am I doing wrong?

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Debug.Write("Foo")
    Debug.Flush()
    Console.WriteLine("foo")
    Console.Beep(800, 100) 'confirm this function is called'
    Me.Close()
End Sub

EDIT: Can a program have a form and a console?

EDIT2: Ho's answer works. However, the output appears on the next command-line prompt. Can a Winforms application tell the command-line to wait until it's finished instead of immediately returning?

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about console