473,386 Members | 1,609 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,386 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 1626

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: 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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
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...
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.