I'm trying to figure out which form is the startup form for a WinForms project. Ive looked for some property in the project or the VB file itself and neither one seems to know the answer. More specifically, I'm looking at the Properties collection of the project and the projectitems objects using the DTE.
Obviously I'm missing it here. Where can I look to find this information
Thanks
Bill

Howto determine the startup form of a project?
Togo
dpollo
It should be 'projectname Properties'.
Then under 'Common Properties' select 'General' in the dialog box that pops up.
The fourth item under the 'Application' group tells you the startup object of your
project.
If you're after how to find this during run-time I don't know.
Raymundo Chapa94595
:)
Bill
IraD
Check Project's Properties collection. If I recall one of the properties exposes startup form. FYI, collection items can be retrieved by name.
Crumbs
Would this work
Sub Macro2()
Dim objProject As Project = DTE.Solution.Projects.Item(1)
For Each objPI As ProjectItem In objProject.ProjectItems
If objPI.Name = "My Project" Then
For Each objPI2 As ProjectItem In objPI.ProjectItems
If objPI2.Name.ToLower = "application.myapp" Then
Dim objXDoc As New XmlDocument
objXDoc.Load(objPI2.FileNames(0))
MsgBox(objXDoc.GetElementsByTagName("MainForm").Item(0).InnerText)
End If
Next
End If
Next
End Sub
Simn
I was looking at the VBProjectProperties3 which has a MyApplication property but it is of type object so I can't tell if it is useful or not. Any ideas Is there any better way to look up the start up form/object
Trevor L.
<
Global.System.Diagnostics.DebuggerStepThroughAttribute()>Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.TestRefresh.Form1
End Sub
which is where the form is actually created.
Ive come to the conclusion that I will have to use the CodeModel to get into this function and parse it out, but the fact remains that this is annoying at best and impossible for people without a good deal of experience.