views:

12

answers:

0

I'm using VB.new to create my own custom Command Line Program. It's a windows form Application that starts a new "cmd.exe" process. My Form has one big TextBox which all the cmd.exe's output is displayed to. And it has a smaller text box in which you can type commands to send to cmd.exe. Everything works for the most part. I can send commands to the command line and and the output is displayed, but the output always seems to be one line behind.

As soon as my app is started the textbox displays the text:

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All Rights Reserved.

But really it should be displaying:

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. C:\Users\MyUsername>

It never wants to display that last line. As Soon as the app starts if I type the command "cd C:\" here's what is displays:

*Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All Rights Reserved. C:\Users\MyUsername> cd C:*

But again, it's not displaying that last line, which should be "C:>" You know what I mean? From what I can gather, maybe the "cmd.exe" just isn't flushing it's buffer because it's not ready to yet. But from what MS MSDN says, when the Async read mode is on, it's supposed to fire the "OutputDataReceived" event anytime text is displayed to the window. How might I go about getting my program to output that last line?