Click here to Skip to main content
15,897,371 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: there probably is a mistake somewhere Pin
Luc Pattyn24-May-11 8:38
sitebuilderLuc Pattyn24-May-11 8:38 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:01
Andraw Tang24-May-11 9:01 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 8:41
mveDave Kreskowiak24-May-11 8:41 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:04
Andraw Tang24-May-11 9:04 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 8:45
Andraw Tang24-May-11 8:45 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 8:51
mveDave Kreskowiak24-May-11 8:51 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:27
Andraw Tang24-May-11 9:27 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 9:49
mveDave Kreskowiak24-May-11 9:49 
First, ReadToEnd isn't going to give you what you're looking for. It'll block until the console has to something to return, and even then, it'll return block of text, most likely NOT all of the text your app output to the console, and it will only read ONE block of text.

Now, if you want to gather all the text the app outputs, and still have a responsive UI (such as the progress bar redrawing itself), you'll have to read the console output asynchronously.

Something like:
Private Sub StartConsoleRead(ByRef st As Stream)
        Dim rdo As New ReadData
        'rdo.s = _conStream.BaseStream
        rdo.s = st

        Dim consoleReadAsyncCallback As New AsyncCallback(AddressOf ConsoleReadCallback)
        _conStream.BaseStream.BeginRead(rdo.buffer, 0, rdo.buffer.Length, consoleReadAsyncCallback, rdo)
    End Sub

    Private Sub ConsoleReadCallback(ByVal asyncResult As IAsyncResult)
        Dim rdo As ReadData = DirectCast(asyncResult.AsyncState, ReadData)
        Dim bytesRead As Integer = rdo.s.EndRead(asyncResult)
        Dim enc As Encoding = Encoding.ASCII
        Dim s As String = enc.GetString(rdo.buffer, 0, bytesRead)

        CmdOutput.Invoke(UpdateCmdOutputDelegate, New Object() {s})
        StartConsoleRead(rdo.s)
    End Sub
 
 

Public Class ReadData
    Public buffer(20480) As Byte
    Public s As Stream
End Class


Also, you're Timer.Interval on the progress bar form should not be 1. Make it something more reasonable, like 250 to 500 (quarter to half a second). Setting it to one will just make your app hog the CPU.

GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 9:41
Andraw Tang24-May-11 9:41 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 9:51
mveDave Kreskowiak24-May-11 9:51 
GeneralRe: there probably is a mistake somewhere Pin
Andraw Tang24-May-11 12:13
Andraw Tang24-May-11 12:13 
GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 12:26
mveDave Kreskowiak24-May-11 12:26 
QuestionVB.NET Handle SQL DB in Multi user application Pin
All Time Programming23-May-11 20:44
All Time Programming23-May-11 20:44 
AnswerRe: VB.NET Handle SQL DB in Multi user application Pin
AspDotNetDev23-May-11 22:01
protectorAspDotNetDev23-May-11 22:01 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
All Time Programming23-May-11 22:34
All Time Programming23-May-11 22:34 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
Thomas Krojer23-May-11 23:13
Thomas Krojer23-May-11 23:13 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
Dave Kreskowiak24-May-11 1:21
mveDave Kreskowiak24-May-11 1:21 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
All Time Programming24-May-11 1:36
All Time Programming24-May-11 1:36 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
Dave Kreskowiak24-May-11 1:55
mveDave Kreskowiak24-May-11 1:55 
GeneralRe: VB.NET Handle SQL DB in Multi user application Pin
All Time Programming24-May-11 1:58
All Time Programming24-May-11 1:58 
Questiongetting value of the textbox to be used in crystal report Pin
clarence_1323-May-11 16:35
clarence_1323-May-11 16:35 
AnswerRe: getting value of the textbox to be used in crystal report Pin
thatraja23-May-11 17:17
professionalthatraja23-May-11 17:17 
GeneralRe: getting value of the textbox to be used in crystal report Pin
clarence_1325-May-11 14:57
clarence_1325-May-11 14:57 
AnswerRe: getting value of the textbox to be used in crystal report Pin
thatraja25-May-11 15:50
professionalthatraja25-May-11 15:50 
GeneralRe: getting value of the textbox to be used in crystal report Pin
clarence_1325-May-11 20:02
clarence_1325-May-11 20:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.