473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

A quick and dirty VB.NET property generator

Modified to work with c#. Only works on one property declaration at a
time. Inserts the public property accessors after the declaration. Cut
and paste to where you need it.

Sub PropertyMacro()
Dim ClassDeclaration As Document = DTE.ActiveDocument
Dim temp As TextWindow =
CType(ClassDeclaration.ActiveWindow.Object, TextWindow)

Dim PropDeclaration As String = "public "
Dim decl As String() = Trim(temp.Selection.Text).Split(" ")
Dim memvar As String = decl(2)
memvar = memvar.Substring(0, memvar.Length - 1)
Dim propName As String = memvar
propName = propName.Substring(1, 1).ToUpper() &
propName.Substring(2)
Dim dataType As String = decl(1)
PropDeclaration += dataType & " " & propName

temp.Selection.LineDown()
temp.Selection.Insert(vbTab & vbTab & PropDeclaration)
temp.Selection.Insert("{")
temp.Selection.Insert("get{")
temp.Selection.Insert("return " & memvar & ";}")
temp.Selection.Insert("set{")
temp.Selection.Insert(memvar & " = value;}")
temp.Selection.Insert("}")
temp.Selection.NewLine()
End Sub
Jul 21 '05 #1
0 1627

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: andy | last post by:
What's the easiest way for a script to throw up simple dialogs such as file select and alerts? I thought there was something in the standard library that didn't need TK and was cross-platform...
15
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that...
2
by: Salad | last post by:
A97. I have a command button to save and exit. I had the code If Me.Dirty Then Docmd.RunCommand acCmdSaveRecord ...more code endif I was getting an error because a value was not getting...
9
by: Susan Bricker | last post by:
I am currently using the OnDirty event of a Form to detect whether any fields have been modified. I set a boolean variable. Then, if the Close button is clicked before the Save button, I can put...
10
by: Michael Maes | last post by:
Hi, I have a BaseClass from which many Classes Derive. In short: the BaseClass provides the functionalities (Methods) and the Derived Classes extend it with Properties. One of the (Base)...
5
by: Dan Iregren | last post by:
Hi, I need to know when a property has ben modified (IsDirty). The most obvious way to solve the problem is perhaps something like the following; Private m_sFirstName As String Private...
0
by: Richard | last post by:
Modified to work with c#. Only works on one property declaration at a time. Inserts the public property accessors after the declaration. Cut and paste to where you need it. Sub PropertyMacro()...
0
by: yp.yean | last post by:
Hi, I created a custom control, and encountered a dirty property value persistence problem. I created a property with a custom class type, call SQLSettings which holds the SQL connection...
3
by: developing | last post by:
Hi, I know aboutthe dirty property that returns about a bool if the reocrd has changed....is there any such option or code for controls? so a dirty property but for indivisual controls on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.