Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to bring the form to front vb.net 2009

How to bring the form to front vb.net 2009

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pankaj Garg
    wrote on last edited by
    #1

    I am using VB.net 2009. How should I bring my form to front. Right now I am able to restrict the user to open the duplicate instance only. But the already opened instance remains minimized. So sometimes , it leads to the confusion that the form is not getting opened and Actually it is already opened in minimized window state. If i changes the window state to maximized. Then it changes the window state also, Because sometimes, the window is in normal mode and is minimized also / the window state us in maximized and minimized mode . How should I resolve this issue?

    Dim objInv As frmWaste = Nothing

    For i As Integer = 0 To My.Application.OpenForms.Count - 1
    Select Case Filename
    Case "frmAdd"
    If (My.Application.OpenForms(i).Name = Filename) Then
    objInv = My.Application.OpenForms(i)
    If (objInv .UserID = id) Then
    objInv .Focus()
    Return True
    End If
    End If
    End Select
    Next

    If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

    S D 2 Replies Last reply
    0
    • P Pankaj Garg

      I am using VB.net 2009. How should I bring my form to front. Right now I am able to restrict the user to open the duplicate instance only. But the already opened instance remains minimized. So sometimes , it leads to the confusion that the form is not getting opened and Actually it is already opened in minimized window state. If i changes the window state to maximized. Then it changes the window state also, Because sometimes, the window is in normal mode and is minimized also / the window state us in maximized and minimized mode . How should I resolve this issue?

      Dim objInv As frmWaste = Nothing

      For i As Integer = 0 To My.Application.OpenForms.Count - 1
      Select Case Filename
      Case "frmAdd"
      If (My.Application.OpenForms(i).Name = Filename) Then
      objInv = My.Application.OpenForms(i)
      If (objInv .UserID = id) Then
      objInv .Focus()
      Return True
      End If
      End If
      End Select
      Next

      If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

      S Offline
      S Offline
      Steven J Jowett
      wrote on last edited by
      #2

      Before you set the Focus, try checking the WindowState and if it is minimised, set it to Normal.

      Pankaj Garg wrote:

      if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

      I have no idea!!! :laugh:

      Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

      1 Reply Last reply
      0
      • P Pankaj Garg

        I am using VB.net 2009. How should I bring my form to front. Right now I am able to restrict the user to open the duplicate instance only. But the already opened instance remains minimized. So sometimes , it leads to the confusion that the form is not getting opened and Actually it is already opened in minimized window state. If i changes the window state to maximized. Then it changes the window state also, Because sometimes, the window is in normal mode and is minimized also / the window state us in maximized and minimized mode . How should I resolve this issue?

        Dim objInv As frmWaste = Nothing

        For i As Integer = 0 To My.Application.OpenForms.Count - 1
        Select Case Filename
        Case "frmAdd"
        If (My.Application.OpenForms(i).Name = Filename) Then
        objInv = My.Application.OpenForms(i)
        If (objInv .UserID = id) Then
        objInv .Focus()
        Return True
        End If
        End If
        End Select
        Next

        If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        There's no such thing as VB.NET 2009. It's 2002, 2003, 2005, or 2008... and soon to be 2010.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        P 1 Reply Last reply
        0
        • D Dave Kreskowiak

          There's no such thing as VB.NET 2009. It's 2002, 2003, 2005, or 2008... and soon to be 2010.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          P Offline
          P Offline
          Pankaj Garg
          wrote on last edited by
          #4

          Sorry, I Meant 2008

          If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups