[dba-VB] VB.Net - minimizing regions in code

John W. Colby jwcolby at colbyconsulting.com
Tue Sep 6 13:42:57 CDT 2005


I added a reference - Right click on the project / add reference.

I just looked up just the phrase dte and found a knowledgebase article that
discuses how to get it.  Not only do you have to set a reference to the lib,
you have to dim a variable and set it:

Dim DTE As EnvDTE.DTE
DTE =
System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE")

Further I have to do that inside each function that uses the DTE (which was
every one).  I could have dimmed DTE global to the module or even to the app
but I am not sure how that would play.  Further since a module does not have
an "init" function, each function has to SET the variable anyway.  It's just
odd to me that published code does not do this stuff as part of the article.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris
Manning
Sent: Tuesday, September 06, 2005 2:36 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] VB.Net - minimizing regions in code


Did you add the reference to the Project itself or did you import it within
a class/module?  If the latter, it is local only to that class/module.  To
do the former, go to the Project menu and find Properties all the way at the
bottom.  Any references you add there are global to the entire project.  You
may still have to instantiate an object variable within the class/module.

Doris Manning
mikedorism at verizon.net

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby
Sent: Tuesday, September 06, 2005 2:21 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] VB.Net - minimizing regions in code

Have you tried this?  I have tried it in VB.Net express and now also in MDE
2002 and it doesn't work in either one of them.  EnvDTE is not recognized,
and if I go add a reference to it it still complains that DTE.ActiveDocumen
needs an instance (is not static).

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com







More information about the dba-VB mailing list