Form not displaying

sabre7

New member
Joined
Oct 14, 2004
Messages
1
Programming Experience
Beginner
Hi -

newbie question here I have a vb.net application made that during it's form load it will run external applications to using the process.start. Everything works great except I never get the form to display with the progress bar as it processes each external application. It will install all the external apps that it runs no problems but form never displays. Is there a way I can have the form display first and then process the external apps?

A Snippet of my code:
VB.NET:
[size=2]
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] computername [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String

[/color][/size][size=2]computername = System.Net.Dns.GetHostName

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] oFile [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.IO.File

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] oWrite [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.IO.StreamWriter

[/size][size=2][color=#008000]' Start the Install

[/color][/size][size=2]ListBox1.Items.Add("Loaded....")

ListBox1.Items.Add(" ")

 

[/size][size=2][color=#008000]' ProgressBar1.Value = 10

[/color][/size][size=2][/size][size=2][color=#008000]' Start my Package Installation Here

[/color][/size][size=2][/size][size=2][color=#008000] 

[/color][/size][size=2][/size][size=2][color=#0000ff]On[/color][/size][size=2] [/size][size=2][color=#0000ff]Error[/color][/size][size=2] [/size][size=2][color=#0000ff]Resume[/color][/size][size=2] [/size][size=2][color=#0000ff]Next

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] startpkg [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.Diagnostics.Process

ListBox1.Items.Add("Processing Package: sample Files")

startpkg.StartInfo.FileName = "sample.exe"

startpkg.StartInfo.WindowStyle = ProcessWindowStyle.Hidden

startpkg.Start()

startpkg.WaitForExit()

startpkg.Close()

oWrite = oFile.CreateText("C:\log.log")

oWrite.WriteLine("Processed Sample Files")

oWrite.WriteLine("")

ProgressBar1.Value = 20

[/size]

Any help is greatly appreciated, in the example above the code is in form load and it runs fine but I never see the form with the progress bar displayed. Thanks
 

suddenelfilio

Well-known member
Joined
Jun 3, 2004
Messages
144
Location
Belgium
Programming Experience
5-10
is all of this in 1 subprocedure? if so you will not see the form because the sub must be completed before updates to the form will be displayed, you should use threading to perform these kind of operations, but I don't know exactly what your level is and its not simple to explain this way I suggest you find some articles handling threading in vb.net
 
Top Bottom