Advertisement

07.10.2008 at 11:18AM PDT, ID: 23554834
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Displaying a Splash Form in a background thread

Asked by ablesa in .Net Editors & IDEs, Visual Studio

I'm using Visual Studio 2005.  My project starts with a Sub Main, so I cannot use the built-in splash form capability of VS.  So, I created a small form to use for a splash.  I would like to display it from Sub Main and then once my MDI form has completely loaded, I want to close the splash form.

I have tried many different things, but so far, I'm not having a lot of luck.  I ended up trying to display the splash form in a background thread so that it would stay up while my app continued to load.  

First Problem:  When the form displays, all of the controls are nothing but white boxes...can't see pictures or text in them.  So, you can see the gray outlines of the splash form, but everywhere a control exists, you see nothing but a white box.

Second Problem:  I'm trying to kill the thread with a "BackGroundThreadWorker.CancelAsync()" call.  This doesn't work...my form never goes away.

I attached some snippets from my code.

Thanks!

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
IN SUB MAIN:
Public Sub Main()
        Dim mBackGroundThreadWorker As New System.ComponentModel.BackgroundWorker
 
        With mBackGroundThreadWorker
            .WorkerReportsProgress = False
            .WorkerSupportsCancellation = True
            ' Set the address of the procedure to kick off the thread and run
            ' the method that we need to run in the thread.
            AddHandler .DoWork, AddressOf BackgroundWorker_DoWork
            ' Set the address of the procedure to run when the thread has completed
            'AddHandler .RunWorkerCompleted, AddressOf BackgroundWorker_RunWorkerCompleted
            ' tell the thread to start running.  This causes the "DoWork" procedure to
            ' be called.
            .RunWorkerAsync()
        End With
 
Private Sub BackgroundWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
        ' Get the BackgroundWorker object that raised this event.
        Dim worker As System.ComponentModel.BackgroundWorker = CType(sender, System.ComponentModel.BackgroundWorker)
 
        e.Result = DisplaySplashForm
    End Sub
 
    Private Function DisplaySplashForm() As Integer
        Dim splashForm As SplashStartup
 
        ' Call the function to execute in the thread.
        splashForm = New SplashStartup
        With splashForm
            .StartPosition = FormStartPosition.CenterScreen
            .FormBorderStyle = FormBorderStyle.None
            .TopMost = True
            .Show()
        End With
 
        Return 1
 
    End Function
.
.
.
  Dim mainMDI As New GUI.MDI(fullName, usersId, cultureKey, _
            domainAccount, privilegeKeyString, privilegeNameString, _
            plantId, plantName, plantNumber, allPlantPrivsForUser, mBackGroundThreadWorker)
        Application.Run(mainMDI)
    End Sub
 
 
 
IN MDI:
Private Sub MDI_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
.
.
.
 
            If Not mSplashBackGroundThreadWorker Is Nothing Then mSplashBackGroundThreadWorker.CancelAsync()
    End Sub
 
Loading Advertisement...
 
[+][-]07.10.2008 at 12:13PM PDT, ID: 21976498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.10.2008 at 08:18PM PDT, ID: 21979712

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, Visual Studio
Sign Up Now!
Solution Provided By: Idle_Mind
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.11.2008 at 05:03AM PDT, ID: 21981523

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 06:27AM PDT, ID: 21982154

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 08:53AM PDT, ID: 21983499

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 09:00AM PDT, ID: 21983555

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 09:10AM PDT, ID: 21983643

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 12:06PM PDT, ID: 21985071

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.11.2008 at 12:10PM PDT, ID: 21985107

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2008 at 06:29AM PDT, ID: 21997827

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.14.2008 at 06:57AM PDT, ID: 21998036

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2008 at 07:33AM PDT, ID: 21998418

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628