If you have some code that would be great...haven't got huge experience with threading
From: ausdotnet-boun...@lists.codify.com [mailto:ausdotnet-boun...@lists.codify.com] On Behalf Of James Chapman-Smith Sent: Friday, 26 February 2010 11:03 PM To: 'ausDotNet' Subject: RE: Splash Screen..thread safe Hi Anthony, The very first thing you should do is remove the "Application.DoEvents()" calls. These are inherently bad and will cause all sorts of concurrency and threading issues. You can end up with re-entrancy & stack overflows... The best thing is to create the splash screen in its own Application Context on a different thread. I can dig some code up if you need it. Cheers. James. From: ausdotnet-boun...@lists.codify.com [mailto:ausdotnet-boun...@lists.codify.com] On Behalf Of Anthony Sent: Friday, 26 February 2010 13:20 To: 'ausDotNet' Subject: Splash Screen..thread safe I have created a class to so i can show a splah screen when ever i need to notify information to the user...works fine but having issues when i run it within a thread...how would i make it tread safe? I have instantiated it within the main form... Imports System.Windows.Forms Public Class FormSplash Dim oControl As Control() Dim oSplash As System.Windows.Forms.Form Sub New() oSplash = CreateSplash("", "") End Sub Public Sub ShowText(ByVal ParentForm As Form, ByVal sText As String) oSplash.StartPosition = FormStartPosition.Manual oSplash.Location = New System.Drawing.Point(ParentForm.Location.X + ((ParentForm.Bounds.Width - oSplash.Width) \ 2), ParentForm.Location.Y + ((ParentForm.Bounds.Height - oSplash.Height) \ 2)) oControl = oSplash.Controls.Find("label1", True) oControl(0).Text = sText Application.DoEvents() oSplash.Show() Application.DoEvents() End Sub Public Sub Hide() oSplash.Hide() End Sub Public Function CreateSplash(ByVal Header As String, ByVal sText As String) As Form Dim Splash As New Form Dim label1 As New Label label1 = New System.Windows.Forms.Label() Splash.SuspendLayout() ' ' label1 ' label1.AutoSize = True label1.Location = New System.Drawing.Point(13, 46) label1.Name = "label1" label1.Size = New System.Drawing.Size(35, 13) label1.TabIndex = 0 label1.Text = sText ' ' Splash ' Splash.AutoScaleDimensions = New System.Drawing.SizeF(6.0F, 13.0F) Splash.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Splash.ClientSize = New System.Drawing.Size(454, 97) Splash.ControlBox = False Splash.Controls.Add(label1) Splash.MaximizeBox = False Splash.MinimizeBox = False Splash.Name = "Splash" Splash.Opacity = 1 Splash.ShowIcon = False Splash.ShowInTaskbar = False Splash.Text = Header Splash.TopMost = True Splash.ResumeLayout(False) Splash.PerformLayout() Return Splash End Function End Class Is your website <http://www.intellixperience.com/signup.aspx> being IntelliXperienced? regards Anthony (*12QWERNB*) Is your website being IntelliXperienced?