Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / January 2006

Tip: Looking for answers? Try searching our database.

custom editor generated code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
anand.bahirwani@gmail.com - 13 Jan 2006 18:55 GMT
Hi,

I've created a custom editor using the Visual Studio 2005 SDK
Integration Package wizard. I modified the editor pane to be a
DataGridView (instead of a text box). The user is expected to manually
add data to the grid.. and it is not connected to any database. I did
bind the DataGridView to a DataTable so that I could easy save and load
the data in XML format.

The next step in my solution requires me to generate some a custom C#
class based on the information entered in the table. I also need for
this class to be associated with my original file in the same was a
Designer.Cs is associated (almost like a child file) with a resx file.

Now I could have my editor generate the class when the data table
changes. However I can't figure out how to associate the generated file
with the original file. Anyone done something like this?
I could also write a custom tool to generate the code (this gives me
the association for free).. but i'd rather not do so as I don't want my
users to know yet another "detail" about the environment that I am
creating. However, I did play with this approach but I couldn't get a
custom too to update without having to save the file. Does anyone know
what event causes the BaseCodeGenerator to get called?

thanks,
Anand
"Ed Dore [MSFT]" - 13 Jan 2006 19:43 GMT
Hi Anand,

It sounds like you want the functionality of a single file generator
(IVsSingleFileGenerator) here. Given that you're asking about the
BaseCodeGenerator class, I'm assuming you're already familiar with this.

There is a new SingleFileGenerator sample included with the December CTP
drop of the Visual Studio SDK, that you might find helpful.

To force the Generate call, you will need to either save the file in
question, or use the VSProjectItem.RunCustomTool() method. For that you'd
have to retrieve the EnvDTE.ProjectItem associated with the file your
editor was operating on, then convert it to a VSProjectItem.

  EnvDTE.ProjectItem projItem = RetrieveMyProjectItem();
  VSLangProj.VSProjectItem vsProjItem = projItem.Object As
VSLangProj.VSProjectItem;

Sincerely,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.