Solved

vb.net splash screen invoke error

Posted on 2014-03-04
4
637 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 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