473,772 Members | 3,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How, can i get all form name that is created on project using vb.net 2008

16 New Member
For Each FRM As Form In Application.Ope nForms
MsgBox(FRM.Name )
Next

only getting open form name... i want all form name used in project
Feb 21 '12 #1
4 1065
PsychoCoder
465 Recognized Expert Moderator Contributor
You're only getting 1 form because you're using Application.Ope nForms, which gives you the name of the currently open form.

Take a look at this code and see if it helps:

Expand|Select|Wrap|Line Numbers
  1. Public Function GetForms(ByVal sender As Object) As List(Of Form)
  2.     Dim Forms As New List(Of Form)()
  3.     Dim formType As Type = Type.GetType("System.Windows.Forms.Form")
  4.     For Each t As Type In sender.GetType().Assembly.GetTypes()
  5.         If UCase(t.BaseType.ToString) = "SYSTEM.WINDOWS.FORMS.FORM" Then
  6.             Forms.Add(t.Name)
  7.         End If
  8.     Next
  9.  
  10.     Return Forms
  11. End Function
Feb 22 '12 #2
Gobi nath
16 New Member
not working.... it made an error "value of type string cant convert to form"
Feb 25 '12 #3
PsychoCoder
465 Recognized Expert Moderator Contributor
You are right about the error, using this code will get the names of all the forms in your project (sorry for the confusion)

Expand|Select|Wrap|Line Numbers
  1. Public Function GetForms(ByVal sender As Object) As List(Of String)
  2.     Dim Forms As New List(Of String)()
  3.  
  4.     For Each t As Type In sender.GetType().Assembly.GetTypes()
  5.         If t.BaseType.ToString().ToUpper() = "SYSTEM.WINDOWS.FORMS.FORM" Then
  6.             Forms.Add(t.Name)
  7.         End If
  8.     Next 
  9. Return Forms
  10. End Function
Feb 26 '12 #4
Gobi nath
16 New Member
Again error

Error 17 Value of type 'System.Collect ions.Generic.Li st(Of String)' cannot be converted to 'System.Collect ions.Generic.Li st(Of System.Windows. Forms.Form)
Feb 27 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1549
by: Scott Navarre | last post by:
Hello, I have a javascript function that I want to read the name of the form which is calling it. Here is my HTML: <HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript">
1
2220
by: David Gagné | last post by:
Hello, My C# solution is composed of 2 projects, a class library project and a Windows application project. The window in one project calls the DLL in the other. That's ok. Now, to better test the solution I would like to create a new Windows application project in that solution so that my 2 other projects are not impacted by this third project. Now this new project would contain the startup Form from which I could open my Form in the...
1
3139
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created elements and would like to seek a solution for this. I had looked through several articles for accessing programatically-created dynamic elements such as: 1)
4
5141
by: Henry | last post by:
Is there a way in ASP.NET/VB.NET to get the current form name. I'd like to store the name in a session variable for use on an Error page and use it to return to the page that had the error. Tks for any input. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
2227
by: Bill Nguyen | last post by:
I would like to add a new VB.NET project using the same folder being used by another project so that I can share several forms already creaded by the other project. However, .NET created a new folder using whatever project name I supplied. Is there a work around for this? Thanks Bill
1
1301
by: Friso Wiskerke | last post by:
Hi All, We've got an VS.2003 ASPNET (VB) webproject which we would like to convert to VS.2005 so that we can make use of the Master Page feature. Converting the initial pages to 2005 is not such a problem (some minor errors) but we run into trouble when we're trying to insert a converted page into a master page content-placeholder. The original page has some Javascript in it which ofcourse references to controls in a form in the page....
6
2154
by: tony | last post by:
Hello! When exactly is it important or advisable to use this form load event handler compare to using the C-tor. For example here I create an event handler called dataBoundGridForm that is called when the form is loaded. this.Load += new System.EventHandler(this.dataBoundGridForm_Load); I mean if I compare form load with the C-tor I think that it's enough to put the code into the C-tor instead
0
498
by: sharmasu | last post by:
Hi, I have windows XP professional, IIS5.0, .net 2.0, .net 1.1 and visual interdev installed on same machine. When i try to create a web project using "web project wizard" I don't see the virtual directory that i have created for the project. Interestingly when i click on asp .net tab of properties windows of that project clicked by selecting properties selecting the virtual directory in IIS, i see the asp .net version set to 2.0. I am...
1
1177
by: Ryan Liu | last post by:
Hi, I have a problem, I am using visual studio 2003 to develop Chinse application, works fine. But when I deploy it, Chinse font can not be seen for shortcuts or folder name created by Visual studio 2003 setup project. Is there a way to fix it?
3
2679
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that report, filtered, from different forms. How do I carry the name of the current form into the
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.