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 VBFieldToProper ty()
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.S tartOfLine(vsSt artOfLineOption s.vsStartOfLine OptionsFirstTex t)
DTE.ActiveDocum ent.Selection.W ordRight()
DTE.ActiveDocum ent.Selection.W ordRight(True)
DTE.ActiveDocum ent.Selection.C opy()
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.N ewLine()
DTE.ActiveDocum ent.Selection.T ext = "public property "
DTE.ActiveDocum ent.Selection.P aste()
DTE.ActiveDocum ent.Selection.W ordLeft()
DTE.ActiveDocum ent.Selection.D elete()
DTE.ActiveDocum ent.Selection.C harRight(True)
DTE.ActiveDocum ent.Selection.C hangeCase(vsCas eOptions.vsCase OptionsUppercas e)
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.L ineUp()
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.W ordLeft(True, 2)
DTE.ActiveDocum ent.Selection.C opy()
DTE.ActiveDocum ent.Selection.L ineDown()
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.P aste()
DTE.ActiveDocum ent.Selection.N ewLine()
DTE.ActiveDocum ent.Selection.T ext = "return "
DTE.ActiveDocum ent.Selection.L ineUp(False, 3)
DTE.ActiveDocum ent.Selection.S tartOfLine(vsSt artOfLineOption s.vsStartOfLine OptionsFirstTex t)
DTE.ActiveDocum ent.Selection.W ordRight()
DTE.ActiveDocum ent.Selection.W ordRight(True)
DTE.ActiveDocum ent.Selection.C opy()
DTE.ActiveDocum ent.Selection.L ineDown(False, 3)
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.P aste()
DTE.ActiveDocum ent.Selection.L ineDown(False, 3)
DTE.ActiveDocum ent.Selection.E ndOfLine()
DTE.ActiveDocum ent.Selection.I ndent(2)
DTE.ActiveDocum ent.Selection.P aste()
DTE.ActiveDocum ent.Selection.T ext = "=value"
DTE.ActiveDocum ent.Selection.L ineDown()
DTE.ActiveDocum ent.Selection.L ineUp()
DTE.ActiveDocum ent.Selection.N ewLine()
DTE.ActiveDocum ent.Selection.L ineDown()
DTE.ActiveDocum ent.Selection.L ineUp(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.goo glegroups.com.. .
is there a way to automatically generate properties from fields in
vs.net