How to bring the form to front vb.net 2009
-
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
NextIf 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!
-
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
NextIf 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!
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.
-
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
NextIf 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!
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 -
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, 2008Sorry, 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!