Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Get a reference to a form given its name

Total Hit ( 1925)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


In some cases you might want to activate a form given its name, but VB doesn't let you do it directly. However, it is easy to create a function that does it by iterating over all the forms in the current project:

Click here to copy the following block
' retrieve a reference to a form given its name
' if there are multiple occurrences of a form, it
' retrieves the first occurrence in the Forms collection

Function GetForm(ByVal formName As String) As Form
  Dim frm As Form
  For Each frm In Forms
    If StrComp(frm.Name, formName, vbTextCompare) = 0 Then
      Set GetForm = frm
      Exit Function
    End If
  Next
End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.