Discussion:
how to add a new form and add controls to it from an add in
(too old to reply)
CJ
2010-03-17 12:46:01 UTC
Permalink
i cant seem to find much info on the dte.itemoperations for adding a from to
an existing and open vb 2008 project.

i want to create a new form in a specific folder under a project. and then i
want to add controls and set properties.

getting the project isnt a problem. adding the form is.

i just cant seem to find any info that is helping me figure this out.
Dee Earley
2010-03-17 15:41:21 UTC
Permalink
Post by CJ
i cant seem to find much info on the dte.itemoperations for adding a from to
an existing and open vb 2008 project.
i want to create a new form in a specific folder under a project. and then i
want to add controls and set properties.
getting the project isnt a problem. adding the form is.
i just cant seem to find any info that is helping me figure this out.
project.VBComponents.Add() seems the obvious choice.. :)
--
Dee Earley (***@icode.co.uk)
i-Catcher Development Team

iCode Systems
Dee Earley
2010-03-17 15:46:47 UTC
Permalink
Post by Dee Earley
Post by CJ
i cant seem to find much info on the dte.itemoperations for adding a from to
an existing and open vb 2008 project.
i want to create a new form in a specific folder under a project. and then i
want to add controls and set properties.
getting the project isnt a problem. adding the form is.
i just cant seem to find any info that is helping me figure this out.
project.VBComponents.Add() seems the obvious choice.. :)
Oops, ignore that, I missed the vb 2008 bit.
--
Dee Earley (***@icode.co.uk)
i-Catcher Development Team

iCode Systems
CJ
2010-03-17 19:06:02 UTC
Permalink
i have been able to get this code:

ProjectObject.DTE.ItemOperations.NewFile("General\Text File", "test.vb",
ViewKind:=Constants.vsViewKindDesigner)

to open a new text file in the ide, but it doesnt get added to the current
project
and i still cant figure out what the syntax would be for adding a form.

HELP
CJ
2010-03-17 19:26:12 UTC
Permalink
ok, after hours of searching i found an example like...

ItemOperations.AddNewItem("Common Items\Windows Forms\Windows Form")

which WORKS. it gives me a new form and it open in the design mode and its
added to the project.

now i just need to change the name, start setting properties, and add
controls to it...

any suggestions out there?
CJ
2010-03-17 20:28:05 UTC
Permalink
and easy enough...

ItemOperations.AddNewItem("Common Items\Windows Forms\Windows Form",
myFileName)

takes care of making it the right name...

now for the adding of contraols...
Nobody
2010-03-21 21:10:11 UTC
Permalink
Post by CJ
vb 2008 project.
This group is for VB6 and earlier(VB Classic). VB.Net and all dotnet groups
have either "dotnet" or "vsnet" in the group name. Please use the following
group instead:

news://msnews.microsoft.com/microsoft.public.dotnet.languages.vb

Loading...