Click here to Skip to main content
15,898,036 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: there probably is a mistake somewhere [modified] Pin
Andraw Tang24-May-11 8:13
Andraw Tang24-May-11 8:13 
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 
Sorry calculation error, I already comment out that line. Now I modify the source codes, also remove the event.

When "Run" menu is clicked, it will call Run_Tool() inside which it start a precess and open a form, I also show the codes for progressbar form below, but the progressbar color is grayed, no value is shown.

Would you please take a look where is wrong? thanks!

  Private Sub Run_Tool()

    Dim sAppPath As String = ".\xxxx.exe"
    Dim fileName As String = "XXXXXX.TXT"
    Dim p As New System.Diagnostics.Process()

    Dim rtnStr As String = String.Empty

    p.StartInfo.FileName = Application.StartupPath & "\" & sAppPath
    p.StartInfo.Arguments = fileName

    'Do not use the system shell to start the program this is so we can hide the command dos window
    p.StartInfo.UseShellExecute = False
    p.StartInfo.WorkingDirectory = strOutputFilePath
    ' Show no dos window if false
    p.StartInfo.CreateNoWindow = True
    p.StartInfo.RedirectStandardOutput = True

    Dim progBarFrm As New FormProgressBar
    progBarFrm.Show()


    Try
        p.Start()
    Catch ex As Exception
        ShowValidationMessage("Unexception error is caught, please close and try again.", "Error")
        'p.Kill()
        progBarFrm.Close()
        Return
    End Try


    rtnStr = p.StandardOutput.ReadToEnd()

    ''p.WaitForExit(120000)   '= 1.5 min: 1000 millisecond = 1 second
    ' if the process doesn't complete within 5400 seconds, kill it
    ''If Not p.HasExited Then
    ''p.Kill()
    ''End If

    If rtnStr.Contains(" FAST terminated normally.") = True Then
        rtnStr = rtnStr & vbCrLf & "Please click Postprocess -> View Output File in menu to view the file."
        updateViewMenu()
    End If
    progBarFrm.Close()

    Dim frm As New FormShowFASTResult
    frm.txtFASTResult.Text = rtnStr
    frm.Button1.Select()
    frm.ShowDialog()

End Sub

Source code for the progressbar form as the following
Public Class FormProgressBar

    Private Sub FormProgressBar_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        Timer1.Stop()
    End Sub



    Private Sub FormProgressBar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CenterToScreen()
        ProgressBar1.Minimum = 0
        ProgressBar1.Maximum = 100
        ProgressBar1.Value = 0
        Timer1.Interval = 1
        Timer1.Start()

    End Sub


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value < 100 Then
            ProgressBar1.Value = ProgressBar1.Value + 1
        Else
            ProgressBar1.Value = 0
        End If
    End Sub
End Class

GeneralRe: there probably is a mistake somewhere Pin
Dave Kreskowiak24-May-11 9:49
mveDave Kreskowiak24-May-11 9:49 
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 

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.