Solved 2005 - Windows Form

Posted on 2006-05-12
Last Modified: 2010-08-05

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?

Question by:murbro
    LVL 7

    Expert Comment

    LVL 7

    Expert Comment

    to make the form appears above all your other apps
    in the form load event

    Me.TopMost = True
    LVL 7

    Accepted Solution

    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.WindowState = FormWindowState.Maximized
                    Exit For
                End If
            If Not formExists Then
                Dim frm As New YOURFORMNAME
                frm.MdiParent = Me
            End If

    Author Comment

    Graet answer!
    Thanks very much for all the info

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now