|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
close automatically a form(as a custom messagebox) with just one label on it. Using System.Threading.Thread.Sleep(3000) does the job but the label text is not shown during these 3 seconds. After the Sleep instruction the label text is shown but is unreadable since I close the form after the "sleep". Using the "Sleep" method during the Closing Event of the form (and thus not in the function used) doesn't solve the problem. Any ideas ? This is the code used: Private Function ShowSuccessMessageBox() Dim message As String Dim w As Int16 Dim h As Int16 fMsgbox = New Form lblMessage = New Label message = "Email and possible attachments successfully saved." w = message.Length With lblMessage .BackColor = Color.Green .ForeColor = Color.White .Font = New Font("Arial", 10, FontStyle.Bold) .Location = New Point(15, 25) .Width = w * 7 .Text = message.ToString End With w = 375 h = 100 With fMsgbox .Controls.Add(lblMessage) .CausesValidation = False .StartPosition = FormStartPosition.CenterScreen .BackColor = System.Drawing.Color.Green .MinimumSize = New System.Drawing.Size(w, h) .MaximumSize = New System.Drawing.Size(w, h) .MinimizeBox = False .MaximizeBox = False .Text = "Successful Save" .Show() End With System.Threading.Thread.Sleep(3000) fMsgbox.Close() fMsgbox = Nothing End Function Hello, DotNetter,
Try adding: Application.DoEvents() directly before: System.Threading.Thread.Sleep(3000) Cheers, Randy dotnetter wrote: Show quoteHide quote > Straight forward action though ... I tkink it's not. I create a form > (as a custom messagebox) with just one label on it. Using > System.Threading.Thread.Sleep(3000) does the job but the label text is > not shown during these 3 seconds. After the Sleep instruction the label > text is shown but is unreadable since I close the form after the > "sleep". Using the "Sleep" method during the Closing Event of the form > (and thus not in the function used) doesn't solve the problem. Any > ideas ? > > This is the code used: > > Private Function ShowSuccessMessageBox() > Dim message As String > Dim w As Int16 > Dim h As Int16 > > fMsgbox = New Form > lblMessage = New Label > > message = "Email and possible attachments successfully saved." > w = message.Length > > With lblMessage > .BackColor = Color.Green > .ForeColor = Color.White > .Font = New Font("Arial", 10, FontStyle.Bold) > .Location = New Point(15, 25) > .Width = w * 7 > .Text = message.ToString > End With > > w = 375 > h = 100 > With fMsgbox > .Controls.Add(lblMessage) > .CausesValidation = False > .StartPosition = FormStartPosition.CenterScreen > .BackColor = System.Drawing.Color.Green > .MinimumSize = New System.Drawing.Size(w, h) > .MaximumSize = New System.Drawing.Size(w, h) > .MinimizeBox = False > .MaximizeBox = False > .Text = "Successful Save" > .Show() > End With > System.Threading.Thread.Sleep(3000) > fMsgbox.Close() > fMsgbox = Nothing > End Function > So simple but also very effective. It works just fine. Thanks a lot for
this solution. Dirk
Sub Main() refusing to work
Reading .csv files containing the "-" character Inherent form controls resize simple queue How do I extend My.Resources System.Timers.Timer.Elapsed event not firing Edit and Continue doesn't work Tree view node selection error Filling resized panel with form .net framework |
|||||||||||||||||||||||