No, but if you use a simple recorded macro you can save the macro for later
use. I just recorded this one directly from the keyboard using the
Ctrl+Shift+R hot-key combination. As you can see, it grabs the field name,
modifies it, pastes in extra bits and creates a property. It uses my
standard of naming fields with an underbar and an initial lower-case letter
so that for example a field named "_foo" creates a property named "Foo"
Sub VBFieldToProperty()
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.StartOfLine(vsStartOf LineOptions.vsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.WordRight()
DTE.ActiveDocument.Selection.WordRight(True)
DTE.ActiveDocument.Selection.Copy()
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "public property "
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.WordLeft()
DTE.ActiveDocument.Selection.Delete()
DTE.ActiveDocument.Selection.CharRight(True)
DTE.ActiveDocument.Selection.ChangeCase(vsCaseOpti ons.vsCaseOptionsUppercase)
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.LineUp()
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.WordLeft(True, 2)
DTE.ActiveDocument.Selection.Copy()
DTE.ActiveDocument.Selection.LineDown()
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Text = "return "
DTE.ActiveDocument.Selection.LineUp(False, 3)
DTE.ActiveDocument.Selection.StartOfLine(vsStartOf LineOptions.vsStartOfLineOptionsFirstText)
DTE.ActiveDocument.Selection.WordRight()
DTE.ActiveDocument.Selection.WordRight(True)
DTE.ActiveDocument.Selection.Copy()
DTE.ActiveDocument.Selection.LineDown(False, 3)
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.LineDown(False, 3)
DTE.ActiveDocument.Selection.EndOfLine()
DTE.ActiveDocument.Selection.Indent(2)
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Selection.Text = "=value"
DTE.ActiveDocument.Selection.LineDown()
DTE.ActiveDocument.Selection.LineUp()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.LineDown()
DTE.ActiveDocument.Selection.LineUp(False, 3)
End Sub
--
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<jw*****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
is there a way to automatically generate properties from fields in
vs.net