Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to add a new form and add controls to it from an add in

12 views
Skip to first unread message

CJ

unread,
Mar 17, 2010, 8:46:01 AM3/17/10
to
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

unread,
Mar 17, 2010, 11:41:21 AM3/17/10
to

project.VBComponents.Add() seems the obvious choice.. :)

--
Dee Earley (dee.e...@icode.co.uk)
i-Catcher Development Team

iCode Systems

Dee Earley

unread,
Mar 17, 2010, 11:46:47 AM3/17/10
to
On 17/03/2010 15:41, Dee Earley wrote:
> On 17/03/2010 12:46, CJ wrote:
>> 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.

CJ

unread,
Mar 17, 2010, 3:06:02 PM3/17/10
to
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

unread,
Mar 17, 2010, 3:26:12 PM3/17/10
to
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

unread,
Mar 17, 2010, 4:28:05 PM3/17/10
to
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

unread,
Mar 21, 2010, 5:10:11 PM3/21/10
to
"CJ" <C...@discussions.microsoft.com> wrote in message
news:6F7B7B55-A0BA-4B09...@microsoft.com...
> 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


0 new messages