[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

vb.net/VSTO 2005 - Windows Form

Hi

I have a Windows form that loads on various events. The trouble is that it loads twice
sometimes. How do prevent this.

Also how do you make sure that a  Windows form appears above all your other apps, files etc.

Is it something to do with focus?

Thanks
0
Murray Brown
Asked:
Murray Brown
  • 3
1 Solution
 
davidrichardsonCommented:
to make the form appears above all your other apps
in the form load event

Me.TopMost = True
0
 
davidrichardsonCommented:
if your form is a mdi child

        Dim formExists As Boolean = False
        For Each childForm As Form In Me.MdiChildren
            If TypeOf childForm Is YOURFORMNAME Then
                formExists = True
                childForm.Activate()
                childForm.WindowState = FormWindowState.Maximized
                Exit For
            End If
        Next
        If Not formExists Then
            Dim frm As New YOURFORMNAME
            frm.MdiParent = Me
            frm.Show()
        End If
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Graet answer!
Thanks very much for all the info
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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