Solved

vb.net splash screen invoke error

Posted on 2014-03-04
4
644 Views
Last Modified: 2014-03-21
Hi,

I have a splash screen in my vb.net app, when I install the program on other computers, I randomly get this error right after the splash screen: ".net framework Unhandled exception : invoke or beginInvoke cannot be called on a control until the window handle has been created."

I know this error is associated to the splash screen because when I bypass it the error never occurs. I've tried some solutions online regarding this issue but I can't seem to get it working.

Thanks for the help
0
Comment
Question by:FCapo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39904157
You probably have some code in Load event of the main form which may need to be moved to Shown event instead.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 39904176
How is your splash screen displayed?  Are you using the default mechanism thru Project --> Properties?...or are you doing it manually?
0
 

Author Comment

by:FCapo
ID: 39904229
Hi,

Yes, I'm using the the default mechanism through Project --> Properties

Here's the code in my load event on my main form, the splash screen has absolutely no code in the load event :

        prjAccessData = New project
        prjManagDataSet = prjAccessData.getPrjAccessDataSet
        prjManagBindingsource = New BindingSource

        prjbudgetData = New project
        prjbudgetDataSet = prjbudgetData.getPrjbudgetDataSet
        prjBudgetBindingsource = New BindingSource

        hoursData = New project
        hoursDataSet = hoursData.getHoursDataSet
        hoursBindingsource = New BindingSource

        With prjManagBindingsource
            .DataSource = prjManagDataSet
            .DataMember = "projets"
        End With

        With hoursBindingsource
            .DataSource = hoursDataSet
            .DataMember = "FeuillesDeTemps"
        End With

        With prjBudgetBindingsource
            .DataSource = prjbudgetDataSet
            .DataMember = "budget"
        End With

        Label4.DataBindings.Add("text", prjManagBindingsource, "prjNumber")
        Label5.DataBindings.Add("text", prjManagBindingsource, "Mandats")
        Label7.DataBindings.Add("text", prjManagBindingsource, "prjAddr")
        Label8.DataBindings.Add("text", prjManagBindingsource, "cliName")
        Label9.DataBindings.Add("text", prjManagBindingsource, "prjContact")

        TabControl1.SelectedIndex = 2
        TabControl1.SelectedIndex = 1
        TabControl1.SelectedIndex = 0

        heuresTotal.DataBindings.Add("text", prjBudgetBindingsource, "heuresTotal")
        chargeTxt.DataBindings.Add("text", prjBudgetBindingsource, "bossHours")
        revTxt.DataBindings.Add("text", prjBudgetBindingsource, "revHours")
        dessTxt.DataBindings.Add("text", prjBudgetBindingsource, "dessHours")
        directTxt.DataBindings.Add("text", prjBudgetBindingsource, "directHours")
        techTxt.DataBindings.Add("text", prjBudgetBindingsource, "techHours")
        rechNotesTxt.DataBindings.Add("text", prjBudgetBindingsource, "notes")

        forageTxt.DataBindings.Add("Text", prjBudgetBindingsource, "forage", True, DataSourceUpdateMode.OnValidation, 0, "C")
        analTxt.DataBindings.Add("Text", prjBudgetBindingsource, "analyse", True, DataSourceUpdateMode.OnValidation, 0, "C")
        TextBox4.DataBindings.Add("Text", prjBudgetBindingsource, "recherche", True, DataSourceUpdateMode.OnValidation, 0, "C")

        Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US", False)
        FeuillesDeTempsDataGridView.AllowUserToAddRows = False

        'Check if the computer is assigned :
        If My.Settings.empName = "" Then
            If MessageBox.Show("There is no Employee assigned to this workstation, would you like to assign one now?", "Feuille De Temps", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
                Form4.ShowDialog()
            Else
                Me.Close()
            End If
        Else
            ' if it is assigned then load up the employee information : 
            empName = My.Settings.empName
            Me.Text = My.Settings.empName
            Me.EmployeesTableAdapter1.FillBy(NCLDataSet.Employees, empName)
            empRate = NCLDataSet.Employees.Rows(0)(2)
        End If
     

Open in new window

0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39904245
I suspect it may be line 58

Me.Close()

You are closing current form before it even has finished loading. I would suggest you move all this code to Shown event which would also make you main form appear quicker (as it would show up quickly).
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question