Need to make startup vb.net form visible once .exe program is ran!

How may I adjust the coding below to allow me to see the form once a person opens up the executable?   Most of the time they will pass a parameter of an Access database and it will run the Test_DB() on the particular database to adjust it along with a Progress Bar to show action.  The problem is that I have it under the Form_Load event and thus doesn't show the form.

I understand what I"m doing wrong but I don't understand how to fix or adjust the syntax to give me what I want.

Please help and thank you.

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim sMsg As String
    Dim sPath As String
    Dim returnValue As String()

    sMsg = "...complete startup of program...check for parameter and if it exists then runs the code on the database..."
    returnValue = Environment.GetCommandLineArgs()
    If returnValue.Length > 1 Then
      sPath = returnValue(1).ToString()
      Try
        Test_DB(sPath)
      Catch exError As Exception
        ErrorMessageString = exError.ToString & " - " & exError.Message
        Call ExceptionClassObject.WriteExceptionErrorToFile(ExceptionErrorFileString, Me.Name, sMsg, ErrorMessageString, WriteErrorMessageString)

      End Try
    End If

    System.Windows.Forms.Application.Exit()
    
  End Sub

Open in new window

LVL 1
stephenlecomptejrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Could you explain a little more what is supposed to happen (and what is happening that shouldn't)....
0
stephenlecomptejrAuthor Commented:
Several steps happen

1. Within Access 2007, a command is given to open my .exe program and pass the name of the database with:  StartDoc ""I:\EC\0MSAccess\UpdateMSAccess.exe""  "C:\Test\adjustme.accdb""

2.  It closes out of C:\Test\adjustme.accdb

3. When the .exe file opens it takes the database and starts making adjustments very quickly.  

As the adjustments are made, I have VB.net coding that displays a Progress Bar as it loops through the database making adjustments to queries, forms and reports.  

But the frmMain.vb (which is the only form in the program) is not visible because its at the Form_Load event.

4.  Once the adjustments are completed it finally opens C:\Test\adjustme.accdb with its adjustments.

5.  Closes out of the .exe program.

I would rather want the form to display itself and show the progress bar as to what it is doing.  

Because people double-click on the Access file again - realizing the database is being updated with the latest queries, forms and reports.
0
stephenlecomptejrAuthor Commented:
Because people double-click on the Access file again - NOT realizing the database is being updated with the latest queries, forms and reports.
0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
What version VB.Net are you using?

To make it start after the form has shown itself use the Shown() event instead of the Load() event.

If you have an early version of .Net then you can force the form to display using this at the top of the Load() event:

    Me.Show()
    Application.DoEvents()

It really sounds like the work should be placed into a separate thread but the best approach depends on your version of VB.Net.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
13598Commented:
Move your code to the frmMain_Shown event. It will run after the form has been loaded.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.