473,770 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can VS.net generate properties

is there a way to automatically generate properties from fields in
vs.net

Nov 21 '05 #1
2 1287
<jw*****@gmail. com> schrieb:
is there a way to automatically generate properties from fields in
vs.net


There is no built-in way to do that, but you can write your own add-in/macro
to create the property or use 3rd-party add-ins which support that.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
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

Nov 21 '05 #3

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

Similar topics

1
1743
by: Lut | last post by:
Hey, I made a custom usercontrol (Custom listview) in the Control Library. Now I want in the properties of design a property 'Sort'. (That is not a problem to do that) But, when it is Yes then I want to add following code in my class. private ListViewSortManager SortMgr1;
1
1284
by: | last post by:
please help me!
1
2325
by: A Traveler | last post by:
Hello, i am having this problem. The exact error message is: "Unable to generate code for a value of type 'System.Web.UI.Page'. This error occurred while trying to generate the property value for Page." After a lot of googling, all i can find that this applies to is when trying to use enum-type datatypes as bit-vector flags, or when use designers to make an expandable property in the property tool-window. However, NEITHer of these...
1
1680
by: Alexander Kaplunov | last post by:
I have a web service, which has a reference to a class. I want to be able to accept this class as a parameter to my web service method. When the consumer consumes the web service, proxy class is created. This proxy has my class but for some reason it does not generate methods, only properties. Here is my code.... ****Class***** public class Class1
8
5822
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 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...
7
2640
by: Sharon | last post by:
I'm writing my own control that derived from the UserControl. In my control I have some public properties (with get and set) that I do not want them to be shown on the designer properties window and I also do not want the Windows Form Designer to generate code automatically on the user Form for them. To block the properties from being shown on the designer properties window I use: public int MyProp
1
2034
by: Carl Johansen | last post by:
Hi all, I have an ASP.NET 2.0 website in Visual Studio 2005 (ie I open it with File | Open Web Site...). I have put XML comments in the source code in the App_Code directory (with <summary> tags, etc) and I want to turn these into XML files that can then be run through NDoc (along with app_code.dll) to produce help files. I've even found an (apparently stable) port of NDoc for v2.0 of the framework. So no problem, I'll just go to...
0
1234
by: TN | last post by:
I created a dataset in code (with extended properties on the table and the columns) and I saved the schema (the properties were there). Now I am trying to take that .xsd file and generate a dataset class. Problem is xsd blows off the extended property definition when it creates the ..cs file. What's up... this is a show-stopper? Is this really true? (VS 2005) Thanks.
2
7391
by: bthubbard | last post by:
This may not be the best group in which to post this. If there is a better location please direct me there. I have been experimenting with Sandcastle to generate CHM help file documentation for some of our projects. I can configure a project(s) to generate the required XML Documentation file by editing the project properties via VS or I believe, if we were using one, a XML configuration file for MSBuild. We usually build our solutions...
7
1336
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I am used to using Java's Eclipse IDE where I can choose one or more fields and have the IDE automatically generate getter and setter methods for it. Is there something in the Visual Studio IDE where I can select a field like "string name;" and automatically generate a Property for it?
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8931
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.