I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a
specialized class that works with my application framework. In the wizard,
the user can select the interfaces they would like to support. During the
code generation phase, I add an "Implements Ixxx" for each interface they
select, but I've not yet figured out how to add the skeleton implementation
for those interfaces. Once the user opens the class in the VS IDE, they
can position the cursor after the interface name and hit return to
auto-generate the implementation. Is there a way to programmatically cause
VB.NET to generate the skeleton implementation for these interfaces using the
extensibility model?
Thanks!
Bill 8 5785
Hi
Based on my knowledge, this job done by VS.NET IDE is achieved by
Intellisense which is not exposed by DTE(IDE) Object Modal.
So far I think we have to do that ourselves.
Here is a similar issue about get...set generator. http://www.codeproject.com/macro/PropertyGenerator.asp
If you have question about the DTE object modal, you may try to post in the
specifed VS.NET IDE extensive newsgroup.
microsoft.public.vstudio.extensibility
If you still have any concern please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Bill,
In addition to Peter's comments.
What are you using to generate the class itself?
Have you considered using Reflection to read the definition of the
Interface, then adding those members to the code that you are creating?
I will try to post an example of using Reflection to read the definition of
an Interface to generate code later...
Hope this helps
Jay
"Bill Rust" <n5****@community.nospam> wrote in message
news:34**********************************@microsof t.com...
| I've created an "Add Item" wizard for VB.NET 2003 that allows a user to
add a
| specialized class that works with my application framework. In the
wizard,
| the user can select the interfaces they would like to support. During the
| code generation phase, I add an "Implements Ixxx" for each interface they
| select, but I've not yet figured out how to add the skeleton
implementation
| for those interfaces. Once the user opens the class in the VS IDE, they
| can position the cursor after the interface name and hit return to
| auto-generate the implementation. Is there a way to programmatically
cause
| VB.NET to generate the skeleton implementation for these interfaces using
the
| extensibility model?
|
| Thanks!
| Bill
|
|
Hi Peter,
Thanks for your suggestions. I'll take a look at the PropertyGenerator
example you cited.
Best regards,
Bill
""Peter Huang" [MSFT]" wrote: Hi
Based on my knowledge, this job done by VS.NET IDE is achieved by Intellisense which is not exposed by DTE(IDE) Object Modal. So far I think we have to do that ourselves. Here is a similar issue about get...set generator. http://www.codeproject.com/macro/PropertyGenerator.asp
If you have question about the DTE object modal, you may try to post in the specifed VS.NET IDE extensive newsgroup. microsoft.public.vstudio.extensibility
If you still have any concern please feel free to post here.
Best regards,
Peter Huang Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Jay,
Thank you for your reply. I figured reflection could be used to
accomplished this task, but I was trying to avoid coding it if the capability
was already available in the DTE. Since it is not, I would sure appreciate
any sample code you can provide.
Best regards,
Bill
"Jay B. Harlow [MVP - Outlook]" wrote: Bill, In addition to Peter's comments.
What are you using to generate the class itself?
Have you considered using Reflection to read the definition of the Interface, then adding those members to the code that you are creating?
I will try to post an example of using Reflection to read the definition of an Interface to generate code later...
Hope this helps Jay
"Bill Rust" <n5****@community.nospam> wrote in message news:34**********************************@microsof t.com... | I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a | specialized class that works with my application framework. In the wizard, | the user can select the interfaces they would like to support. During the | code generation phase, I add an "Implements Ixxx" for each interface they | select, but I've not yet figured out how to add the skeleton implementation | for those interfaces. Once the user opens the class in the VS IDE, they | can position the cursor after the interface name and hit return to | auto-generate the implementation. Is there a way to programmatically cause | VB.NET to generate the skeleton implementation for these interfaces using the | extensibility model? | | Thanks! | Bill | |
Bill,
Here is an example that uses Reflection & the Code Dom to implement an
interface.
There seems to be a problem with the CodeMemberEvent.ImplementationTypes
member of the CodeDom. For example if I
Implements System.ComponentModel.IComponent
My routine creates:
Public Event Disposed As System.EventHandler
Instead of:
Public Event Disposed As System.EventHandler Implements
IComponent.Disposed
The code for Properties & Methods work, however Events fail, so I'm not sure
what the problem is. I'm checking into it. Cannot think of a workaround
right now.
You can use CodeTypeMember.Attributes to control the visibility of the
generated members. Or use PrivateImplementationType member of
CodeMemberEvent, CodeMemberProperty & CodeMemberMethod to "hide" the
implementation of the methods...
Hope this helps
Jay
---x--- cut here ---x---
Option Strict On
Option Explicit On
Imports System.CodeDom
Imports System.CodeDom.Compiler
Imports System.IO
Imports System.Reflection
Public Module GenerateInterface
Public Sub Main()
Dim unit As New CodeCompileUnit
Dim ns As New CodeNamespace("Sample")
unit.Namespaces.Add(ns)
Dim type As CodeTypeDeclaration = BuildClass(ns, "BillRust",
GetType(Object))
ImplementInterface(type,
GetType(System.ComponentModel.IBindingList))
GenerateCode(unit, "BillRust.vb", New VBCodeProvider)
End Sub
Private Sub ImplementInterface(ByVal baseType As CodeTypeDeclaration,
ByVal implementedType As Type)
baseType.BaseTypes.Add(New CodeTypeReference(implementedType))
ImplementInterfaceMembers(baseType, implementedType)
For Each baseInterface As Type In implementedType.GetInterfaces()
ImplementInterfaceMembers(baseType, baseInterface)
Next
End Sub
Private Sub ImplementInterfaceMembers(ByVal baseType As
CodeTypeDeclaration, ByVal implementedType As Type)
ImplementInterfaceEvents(baseType, implementedType)
ImplementInterfaceProperties(baseType, implementedType)
ImplementInterfaceMethods(baseType, implementedType)
End Sub
Private Sub ImplementInterfaceEvents(ByVal baseType As
CodeTypeDeclaration, ByVal implementedType As Type)
For Each [event] As EventInfo In implementedType.GetEvents()
Dim member As New CodeMemberEvent
member.Name = [event].Name
member.Attributes = MemberAttributes.Public
member.Type = New CodeTypeReference([event].EventHandlerType)
member.ImplementationTypes.Add(implementedType)
baseType.Members.Add(member)
Next
End Sub
Private Sub ImplementInterfaceProperties(ByVal baseType As
CodeTypeDeclaration, ByVal implementedType As Type)
For Each [property] As PropertyInfo In
implementedType.GetProperties()
Dim member As New CodeMemberProperty
member.Name = [property].Name
member.Attributes = MemberAttributes.Public
member.HasGet = [property].CanRead
member.HasSet = [property].CanWrite
member.Type = New CodeTypeReference([property].PropertyType)
ImplementParameters(member.Parameters,
[property].GetIndexParameters())
member.ImplementationTypes.Add(implementedType)
baseType.Members.Add(member)
Next
End Sub
Private Sub ImplementInterfaceMethods(ByVal baseType As
CodeTypeDeclaration, ByVal implementedType As Type)
Static void As Type = Type.GetType("System.Void")
For Each [method] As MethodInfo In implementedType.GetMethods()
If Not [method].IsSpecialName Then
Dim member As New CodeMemberMethod
member.Attributes = MemberAttributes.Public
member.Name = [method].Name
member.ReturnType = New
CodeTypeReference([method].ReturnType)
ImplementParameters(member.Parameters,
[method].GetParameters())
member.ImplementationTypes.Add(implementedType)
baseType.Members.Add(member)
End If
Next
End Sub
Private Sub ImplementParameters(ByVal outputParameters As
CodeParameterDeclarationExpressionCollection, ByVal inputParameters() As
ParameterInfo)
For Each parameter As ParameterInfo In inputParameters
Dim value As New CodeParameterDeclarationExpression
value.Name = parameter.Name
value.Type = New CodeTypeReference(parameter.ParameterType)
outputParameters.Add(value)
Next
End Sub
Private Function BuildClass(ByVal ns As CodeNamespace, ByVal name As
String, ByVal baseType As Type) As CodeTypeDeclaration
Dim type As New CodeTypeDeclaration(name)
ns.Types.Add(type)
type.BaseTypes.Add(baseType)
Return type
End Function
Private Sub GenerateCode(ByVal unit As CodeCompileUnit, ByVal file As
String, ByVal provider As CodeDomProvider)
Dim output As New StreamWriter(file)
Dim generator As ICodeGenerator = provider.CreateGenerator()
Dim options As New CodeGeneratorOptions
options.BlankLinesBetweenMembers = True
options.BracingStyle = "C"
unit.UserData.Add("AllowLateBound", False)
unit.UserData.Add("RequireVariableDeclaration", True)
Try
generator.GenerateCodeFromCompileUnit(unit, output, options)
Catch e As Exception
Debug.WriteLine(e, "GenerateCode")
Finally
output.Flush()
output.Close()
provider.Dispose()
End Try
End Sub
End Module
---x--- cut here ---x---
"Bill Rust" <n5****@community.nospam> wrote in message
news:50**********************************@microsof t.com...
| Hi Jay,
|
| Thank you for your reply. I figured reflection could be used to
| accomplished this task, but I was trying to avoid coding it if the
capability
| was already available in the DTE. Since it is not, I would sure
appreciate
| any sample code you can provide.
|
| Best regards,
| Bill
|
| "Jay B. Harlow [MVP - Outlook]" wrote:
|
| > Bill,
| > In addition to Peter's comments.
| >
| > What are you using to generate the class itself?
| >
| > Have you considered using Reflection to read the definition of the
| > Interface, then adding those members to the code that you are creating?
| >
| > I will try to post an example of using Reflection to read the definition
of
| > an Interface to generate code later...
| >
| > Hope this helps
| > Jay
| >
| > "Bill Rust" <n5****@community.nospam> wrote in message
| > news:34**********************************@microsof t.com...
| > | I've created an "Add Item" wizard for VB.NET 2003 that allows a user
to
| > add a
| > | specialized class that works with my application framework. In the
| > wizard,
| > | the user can select the interfaces they would like to support. During
the
| > | code generation phase, I add an "Implements Ixxx" for each interface
they
| > | select, but I've not yet figured out how to add the skeleton
| > implementation
| > | for those interfaces. Once the user opens the class in the VS IDE,
they
| > | can position the cursor after the interface name and hit return to
| > | auto-generate the implementation. Is there a way to programmatically
| > cause
| > | VB.NET to generate the skeleton implementation for these interfaces
using
| > the
| > | extensibility model?
| > |
| > | Thanks!
| > | Bill
| > |
| > |
| >
| >
| >
Thanks, Jay. I'll give it a try :-)
"Jay B. Harlow [MVP - Outlook]" wrote: Bill, Here is an example that uses Reflection & the Code Dom to implement an interface.
There seems to be a problem with the CodeMemberEvent.ImplementationTypes member of the CodeDom. For example if I
Implements System.ComponentModel.IComponent
My routine creates:
Public Event Disposed As System.EventHandler
Instead of:
Public Event Disposed As System.EventHandler Implements IComponent.Disposed
The code for Properties & Methods work, however Events fail, so I'm not sure what the problem is. I'm checking into it. Cannot think of a workaround right now.
You can use CodeTypeMember.Attributes to control the visibility of the generated members. Or use PrivateImplementationType member of CodeMemberEvent, CodeMemberProperty & CodeMemberMethod to "hide" the implementation of the methods...
Hope this helps Jay
---x--- cut here ---x--- Option Strict On Option Explicit On
Imports System.CodeDom Imports System.CodeDom.Compiler
Imports System.IO Imports System.Reflection
Public Module GenerateInterface
Public Sub Main() Dim unit As New CodeCompileUnit
Dim ns As New CodeNamespace("Sample") unit.Namespaces.Add(ns)
Dim type As CodeTypeDeclaration = BuildClass(ns, "BillRust", GetType(Object))
ImplementInterface(type, GetType(System.ComponentModel.IBindingList))
GenerateCode(unit, "BillRust.vb", New VBCodeProvider) End Sub
Private Sub ImplementInterface(ByVal baseType As CodeTypeDeclaration, ByVal implementedType As Type) baseType.BaseTypes.Add(New CodeTypeReference(implementedType))
ImplementInterfaceMembers(baseType, implementedType)
For Each baseInterface As Type In implementedType.GetInterfaces() ImplementInterfaceMembers(baseType, baseInterface) Next
End Sub
Private Sub ImplementInterfaceMembers(ByVal baseType As CodeTypeDeclaration, ByVal implementedType As Type) ImplementInterfaceEvents(baseType, implementedType) ImplementInterfaceProperties(baseType, implementedType) ImplementInterfaceMethods(baseType, implementedType) End Sub
Private Sub ImplementInterfaceEvents(ByVal baseType As CodeTypeDeclaration, ByVal implementedType As Type) For Each [event] As EventInfo In implementedType.GetEvents() Dim member As New CodeMemberEvent member.Name = [event].Name member.Attributes = MemberAttributes.Public member.Type = New CodeTypeReference([event].EventHandlerType) member.ImplementationTypes.Add(implementedType) baseType.Members.Add(member) Next End Sub
Private Sub ImplementInterfaceProperties(ByVal baseType As CodeTypeDeclaration, ByVal implementedType As Type) For Each [property] As PropertyInfo In implementedType.GetProperties() Dim member As New CodeMemberProperty member.Name = [property].Name member.Attributes = MemberAttributes.Public member.HasGet = [property].CanRead member.HasSet = [property].CanWrite member.Type = New CodeTypeReference([property].PropertyType) ImplementParameters(member.Parameters, [property].GetIndexParameters()) member.ImplementationTypes.Add(implementedType) baseType.Members.Add(member) Next End Sub
Private Sub ImplementInterfaceMethods(ByVal baseType As CodeTypeDeclaration, ByVal implementedType As Type) Static void As Type = Type.GetType("System.Void") For Each [method] As MethodInfo In implementedType.GetMethods() If Not [method].IsSpecialName Then Dim member As New CodeMemberMethod member.Attributes = MemberAttributes.Public member.Name = [method].Name member.ReturnType = New CodeTypeReference([method].ReturnType) ImplementParameters(member.Parameters, [method].GetParameters()) member.ImplementationTypes.Add(implementedType) baseType.Members.Add(member) End If Next End Sub
Private Sub ImplementParameters(ByVal outputParameters As CodeParameterDeclarationExpressionCollection, ByVal inputParameters() As ParameterInfo) For Each parameter As ParameterInfo In inputParameters Dim value As New CodeParameterDeclarationExpression value.Name = parameter.Name value.Type = New CodeTypeReference(parameter.ParameterType) outputParameters.Add(value) Next End Sub
Private Function BuildClass(ByVal ns As CodeNamespace, ByVal name As String, ByVal baseType As Type) As CodeTypeDeclaration Dim type As New CodeTypeDeclaration(name) ns.Types.Add(type)
type.BaseTypes.Add(baseType)
Return type End Function
Private Sub GenerateCode(ByVal unit As CodeCompileUnit, ByVal file As String, ByVal provider As CodeDomProvider) Dim output As New StreamWriter(file) Dim generator As ICodeGenerator = provider.CreateGenerator() Dim options As New CodeGeneratorOptions options.BlankLinesBetweenMembers = True options.BracingStyle = "C"
unit.UserData.Add("AllowLateBound", False) unit.UserData.Add("RequireVariableDeclaration", True)
Try generator.GenerateCodeFromCompileUnit(unit, output, options) Catch e As Exception Debug.WriteLine(e, "GenerateCode") Finally output.Flush() output.Close() provider.Dispose() End Try End Sub
End Module
---x--- cut here ---x---
"Bill Rust" <n5****@community.nospam> wrote in message news:50**********************************@microsof t.com... | Hi Jay, | | Thank you for your reply. I figured reflection could be used to | accomplished this task, but I was trying to avoid coding it if the capability | was already available in the DTE. Since it is not, I would sure appreciate | any sample code you can provide. | | Best regards, | Bill | | "Jay B. Harlow [MVP - Outlook]" wrote: | | > Bill, | > In addition to Peter's comments. | > | > What are you using to generate the class itself? | > | > Have you considered using Reflection to read the definition of the | > Interface, then adding those members to the code that you are creating? | > | > I will try to post an example of using Reflection to read the definition of | > an Interface to generate code later... | > | > Hope this helps | > Jay | > | > "Bill Rust" <n5****@community.nospam> wrote in message | > news:34**********************************@microsof t.com... | > | I've created an "Add Item" wizard for VB.NET 2003 that allows a user to | > add a | > | specialized class that works with my application framework. In the | > wizard, | > | the user can select the interfaces they would like to support. During the | > | code generation phase, I add an "Implements Ixxx" for each interface they | > | select, but I've not yet figured out how to add the skeleton | > implementation | > | for those interfaces. Once the user opens the class in the VS IDE, they | > | can position the cursor after the interface name and hit return to | > | auto-generate the implementation. Is there a way to programmatically | > cause | > | VB.NET to generate the skeleton implementation for these interfaces using | > the | > | extensibility model? | > | | > | Thanks! | > | Bill | > | | > | | > | > | >
Bill,
| > The code for Properties & Methods work, however Events fail, so I'm not
sure
| > what the problem is. I'm checking into it. Cannot think of a workaround
| > right now.
Just realized: If events are important, using a CodeSnippet may be the
workaround, I don't have an example right now.
I'm going to try my routine in VS.NET 2005 to see if it has the same problem
with events.
Hope this helps
Jay
"Bill Rust" <n5****@community.nospam> wrote in message
news:88**********************************@microsof t.com...
| Thanks, Jay. I'll give it a try :-)
|
| "Jay B. Harlow [MVP - Outlook]" wrote:
|
| > Bill,
| > Here is an example that uses Reflection & the Code Dom to implement an
| > interface.
| >
| > There seems to be a problem with the CodeMemberEvent.ImplementationTypes
| > member of the CodeDom. For example if I
| >
| > Implements System.ComponentModel.IComponent
| >
| >
| > My routine creates:
| >
| > Public Event Disposed As System.EventHandler
| >
| > Instead of:
| >
| > Public Event Disposed As System.EventHandler Implements
| > IComponent.Disposed
| >
| > The code for Properties & Methods work, however Events fail, so I'm not
sure
| > what the problem is. I'm checking into it. Cannot think of a workaround
| > right now.
| >
| > You can use CodeTypeMember.Attributes to control the visibility of the
| > generated members. Or use PrivateImplementationType member of
| > CodeMemberEvent, CodeMemberProperty & CodeMemberMethod to "hide" the
| > implementation of the methods...
| >
| > Hope this helps
| > Jay
| >
| > ---x--- cut here ---x---
| > Option Strict On
| > Option Explicit On
| >
| > Imports System.CodeDom
| > Imports System.CodeDom.Compiler
| >
| > Imports System.IO
| > Imports System.Reflection
| >
| > Public Module GenerateInterface
| >
| > Public Sub Main()
| > Dim unit As New CodeCompileUnit
| >
| > Dim ns As New CodeNamespace("Sample")
| > unit.Namespaces.Add(ns)
| >
| > Dim type As CodeTypeDeclaration = BuildClass(ns, "BillRust",
| > GetType(Object))
| >
| > ImplementInterface(type,
| > GetType(System.ComponentModel.IBindingList))
| >
| > GenerateCode(unit, "BillRust.vb", New VBCodeProvider)
| > End Sub
| >
| > Private Sub ImplementInterface(ByVal baseType As
CodeTypeDeclaration,
| > ByVal implementedType As Type)
| > baseType.BaseTypes.Add(New CodeTypeReference(implementedType))
| >
| > ImplementInterfaceMembers(baseType, implementedType)
| >
| > For Each baseInterface As Type In
implementedType.GetInterfaces()
| > ImplementInterfaceMembers(baseType, baseInterface)
| > Next
| >
| > End Sub
| >
| > Private Sub ImplementInterfaceMembers(ByVal baseType As
| > CodeTypeDeclaration, ByVal implementedType As Type)
| > ImplementInterfaceEvents(baseType, implementedType)
| > ImplementInterfaceProperties(baseType, implementedType)
| > ImplementInterfaceMethods(baseType, implementedType)
| > End Sub
| >
| > Private Sub ImplementInterfaceEvents(ByVal baseType As
| > CodeTypeDeclaration, ByVal implementedType As Type)
| > For Each [event] As EventInfo In implementedType.GetEvents()
| > Dim member As New CodeMemberEvent
| > member.Name = [event].Name
| > member.Attributes = MemberAttributes.Public
| > member.Type = New
CodeTypeReference([event].EventHandlerType)
| > member.ImplementationTypes.Add(implementedType)
| > baseType.Members.Add(member)
| > Next
| > End Sub
| >
| > Private Sub ImplementInterfaceProperties(ByVal baseType As
| > CodeTypeDeclaration, ByVal implementedType As Type)
| > For Each [property] As PropertyInfo In
| > implementedType.GetProperties()
| > Dim member As New CodeMemberProperty
| > member.Name = [property].Name
| > member.Attributes = MemberAttributes.Public
| > member.HasGet = [property].CanRead
| > member.HasSet = [property].CanWrite
| > member.Type = New CodeTypeReference([property].PropertyType)
| > ImplementParameters(member.Parameters,
| > [property].GetIndexParameters())
| > member.ImplementationTypes.Add(implementedType)
| > baseType.Members.Add(member)
| > Next
| > End Sub
| >
| > Private Sub ImplementInterfaceMethods(ByVal baseType As
| > CodeTypeDeclaration, ByVal implementedType As Type)
| > Static void As Type = Type.GetType("System.Void")
| > For Each [method] As MethodInfo In implementedType.GetMethods()
| > If Not [method].IsSpecialName Then
| > Dim member As New CodeMemberMethod
| > member.Attributes = MemberAttributes.Public
| > member.Name = [method].Name
| > member.ReturnType = New
| > CodeTypeReference([method].ReturnType)
| > ImplementParameters(member.Parameters,
| > [method].GetParameters())
| > member.ImplementationTypes.Add(implementedType)
| > baseType.Members.Add(member)
| > End If
| > Next
| > End Sub
| >
| > Private Sub ImplementParameters(ByVal outputParameters As
| > CodeParameterDeclarationExpressionCollection, ByVal inputParameters() As
| > ParameterInfo)
| > For Each parameter As ParameterInfo In inputParameters
| > Dim value As New CodeParameterDeclarationExpression
| > value.Name = parameter.Name
| > value.Type = New CodeTypeReference(parameter.ParameterType)
| > outputParameters.Add(value)
| > Next
| > End Sub
| >
| > Private Function BuildClass(ByVal ns As CodeNamespace, ByVal name As
| > String, ByVal baseType As Type) As CodeTypeDeclaration
| > Dim type As New CodeTypeDeclaration(name)
| > ns.Types.Add(type)
| >
| > type.BaseTypes.Add(baseType)
| >
| > Return type
| > End Function
| >
| > Private Sub GenerateCode(ByVal unit As CodeCompileUnit, ByVal file
As
| > String, ByVal provider As CodeDomProvider)
| > Dim output As New StreamWriter(file)
| > Dim generator As ICodeGenerator = provider.CreateGenerator()
| > Dim options As New CodeGeneratorOptions
| > options.BlankLinesBetweenMembers = True
| > options.BracingStyle = "C"
| >
| > unit.UserData.Add("AllowLateBound", False)
| > unit.UserData.Add("RequireVariableDeclaration", True)
| >
| > Try
| > generator.GenerateCodeFromCompileUnit(unit, output, options)
| > Catch e As Exception
| > Debug.WriteLine(e, "GenerateCode")
| > Finally
| > output.Flush()
| > output.Close()
| > provider.Dispose()
| > End Try
| > End Sub
| >
| > End Module
| >
| > ---x--- cut here ---x---
| >
| > "Bill Rust" <n5****@community.nospam> wrote in message
| > news:50**********************************@microsof t.com...
| > | Hi Jay,
| > |
| > | Thank you for your reply. I figured reflection could be used to
| > | accomplished this task, but I was trying to avoid coding it if the
| > capability
| > | was already available in the DTE. Since it is not, I would sure
| > appreciate
| > | any sample code you can provide.
| > |
| > | Best regards,
| > | Bill
| > |
| > | "Jay B. Harlow [MVP - Outlook]" wrote:
| > |
| > | > Bill,
| > | > In addition to Peter's comments.
| > | >
| > | > What are you using to generate the class itself?
| > | >
| > | > Have you considered using Reflection to read the definition of the
| > | > Interface, then adding those members to the code that you are
creating?
| > | >
| > | > I will try to post an example of using Reflection to read the
definition
| > of
| > | > an Interface to generate code later...
| > | >
| > | > Hope this helps
| > | > Jay
| > | >
| > | > "Bill Rust" <n5****@community.nospam> wrote in message
| > | > news:34**********************************@microsof t.com...
| > | > | I've created an "Add Item" wizard for VB.NET 2003 that allows a
user
| > to
| > | > add a
| > | > | specialized class that works with my application framework. In
the
| > | > wizard,
| > | > | the user can select the interfaces they would like to support.
During
| > the
| > | > | code generation phase, I add an "Implements Ixxx" for each
interface
| > they
| > | > | select, but I've not yet figured out how to add the skeleton
| > | > implementation
| > | > | for those interfaces. Once the user opens the class in the VS
IDE,
| > they
| > | > | can position the cursor after the interface name and hit return to
| > | > | auto-generate the implementation. Is there a way to
programmatically
| > | > cause
| > | > | VB.NET to generate the skeleton implementation for these
interfaces
| > using
| > | > the
| > | > | extensibility model?
| > | > |
| > | > | Thanks!
| > | > | Bill
| > | > |
| > | > |
| > | >
| > | >
| > | >
| >
| >
| >
Hi Bill,
Thanks for your quickly reply!
If you still have any concern, please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Yudan YI \(OSU\) |
last post by:
I want to generate random data from a normal distribution, while I checked
the functions, and I found rand(), which returns a pseudorandom integer
between zero and RAND_MAX. I am not sure how to...
|
by: SalimShahzad |
last post by:
Dear Gurus,
i had written following codes to auto generate the next claim no
Private Const strC = "GCT/02/J/"
Private Sub Command1_Click()
Dim stra, stre As String
Dim intb, intd As Integer...
|
by: Jeff Louie |
last post by:
Can anyone explain why a interface method implementation using the fully
qualified name cannot be public or protected? Sample below:
public interface IDrawable
{
void DrawYourself();
}
public...
|
by: Ole Hanson |
last post by:
I am accessing my database through an interface, to allow future
substitution of the physical datastore - hence I would like to declare in my
Interface that my DAL-objects implementing the...
|
by: Ricky W. Hunt |
last post by:
It's dawning on my a lot of my problems with VB.NET is I'm still approaching
it in the same way I've programmed since the late 70's. I've always been
very structured, flow-charted everything, used...
|
by: Bill Rust |
last post by:
I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a
specialized class that works with my application framework. In the wizard,
the user can select the interfaces they...
|
by: |
last post by:
Hi, can someone provide some advise on how to get around with using auto
generated proxies?
basically I already have the proxy classes, and they are used by other
places. I'd like use these...
|
by: Luc Kumps |
last post by:
(Sorry about the previous post, it got transmitted before it was complete)
We try to separate implementation and interface defintions, but we run into
a problem. I hope the guru's can solve this,...
|
by: Sebastian |
last post by:
Hi,
I'm confronted with a problem that seems not to be solvable. In
general: How can I override an interface member of my base class and
call the overridden method from my derived class?
This...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |