Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2003, 05:02 PM
Registered User
 
Join Date: Sep 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can i avoid a form from being displayed ?

Hello all,
I want to know how I can avoid a form from being displayed if an instance of the same form is already being displayed or visible.
I will be thankful to all of you.
Regards,
Misbah H. Ansari


 
Old September 17th, 2003, 12:48 PM
Authorized User
 
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Misbah

You need to check to see if the form is not nothing, meaning that it must be created if it is then use the bringtofront property, this will bring the form to the fore gound,if the form is nothing then create an instance of the form.

 'if the form is equal to nothing or isdisposed then create it
                If frmPart Is Nothing OrElse frmPart.IsDisposed Then
                    frmPart = New frmParts
                    frmPart.MdiParent = Me
                    frmPart.Show()
                Else
                    'if form already open bring it to the fron
                    frmPart.BringToFront()
                End If

the code is for a mdi app, to use in an sdi remove the mdiparent line

HTH Duncan

Duncan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing the records displayed in a form DrewMills Access VBA 2 March 3rd, 2005 07:51 PM
how to avoid logon justin_min Crystal Reports 0 November 30th, 2004 02:05 PM
Trying to avoid duplicacy aspadda Excel VBA 0 April 23rd, 2004 12:59 PM
How do I Avoid a ROLLBACK when... wmhhodson SQL Server 2000 1 October 31st, 2003 01:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.