0 Replies - 534 Views - Last Post: 11 April 2013 - 03:23 PM Rate Topic: -----

#1 doothedew  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 09-July 11

Using Visual Studio Templates to Create a Class

Posted 11 April 2013 - 03:23 PM

I am trying to create and use a template for an abstract class that I am creating. To goal is to alert the user of the template to variables he/she has to change in the class. I can load the template but I don't know how to visually tag which variables to change without making the template have uncompilable errors or commenting everything that needs to change. Is there a better way? It seems like there is but I looked at microsofts website and they talk about replacing parameters but where does this come into play?

Here is the class template.

'The class name would be replaced with what was specified when user added the new item
Public Class TagImport
   Inherits Template

   Public Sub New(ByVal fileName As String)
      MyBase.New(fileName)
   End Sub

   Public Overrides Sub IsValid()
      Select Case True
         Case RowCount > 0
         Case ColCount > 8 'Programmer specified parameter that needs to change
      End Select
   End Sub
End Class



Additional info:

To create the template I selected File -> Export Template... and then followed the wizard selecting the class I wanted to create as an item template. Then to open the template I selected Project -> Add New Item and then selected the template I just created. Loads the template but doesn't do anything with variables.

This post has been edited by doothedew: 11 April 2013 - 03:30 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1