[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

VisibleChanged - only interested in knowing when form is visible

   Private Sub MainForm_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.VisibleChanged
        MessageBox.Show("hi")
    End Sub


The messagebox displays twice, once while the form is still not visible, and once when the form becomes visible.

How can I make the messagebox come up ONLY when the form becomes visible?  

Perhaps I am using the wrong event?
0
Tom Knowlton
Asked:
Tom Knowlton
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Try...

    Private Sub MainForm_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.VisibleChanged
        Dim frm As Form = CType(sender, Form)
        If frm.Visible Then
            MessageBox.Show("hi")
        End If
    End Sub
0
 
Tom KnowltonWeb developerAuthor Commented:
Works like a charm!

Thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now