473,810 Members | 3,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change string to property name?

16 New Member
I want to change the string name to property name..
for example
Expand|Select|Wrap|Line Numbers
  1.  
  2. public class Code
  3. {
  4. public int RD{get;set;}
  5.  
  6. public Code()
  7. {
  8.    GetCode();
  9. }
  10.  
  11. private void GetCode()
  12. {
  13. string cd= "RD";
  14. cd=1; // cd represent to property name "RD" 
  15. }
  16.  
  17. }
  18.  
Apr 23 '12 #1
2 2154
rekedtechie
51 New Member
Expand|Select|Wrap|Line Numbers
  1. public class code
  2. {
  3. public int RD { get; set; }
  4. }
  5.  
  6. public class CodeProgram
  7. {
  8. public static void main()
  9. {
  10. code cd = new code();
  11. cd.RD=1;
  12. Console.Write{"{0}",cd.RD);
  13. }
  14. }
  15.  
Apr 24 '12 #2
RhysW
70 New Member
rekedtechie all that does it write the string to the console, which isn't even close to what he wants, i'm assuming from his description he wants to be able to type in a string and have that string used to create a property with the inputted string as its name, unfortunately i don't think this is even possible to do.

During runtime the program runs the code that it already has, you can't add more to it or take it away, can i ask WHY you are trying to make a specific name for a property? perhaps if we understand more about what you are doing we can provide other ways to do it.

RhysW
Apr 24 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1891
by: Antonio Paglia | last post by:
Imaginate you have one method that accept some arguments like: 1- a control 2- un Type (MyType) 3- el nombre de una Propiedad "PropertyName" Example: .Add(Me.txtCustomerID, GetType(Customer), "CustomerID")
2
2053
by: Jennyfer J Barco | last post by:
Hello, I have the following: <HEAD id="ENGINE"> <title>WebBase.NET Engine</title> <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR"> <meta content="Visual Basic 7.0" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <meta http-equiv="scanner" content="Disabled">
4
1586
by: Bill Borg | last post by:
Hello, I've got a simple shared property, e.g. Public Class dbObject Private Const m_ID As String = "ID" Public Shared ReadOnly Property ID() As String Get Return m_ID End Get End Property
6
10684
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the...
7
1577
by: JohnR | last post by:
I have a user defined class that contains about 20 private variables with their associated properties and get-sets. I have named the properties with very user readable names. I would like to generate a datagrid with 2 columns. One column would have the actual name of the property, and the other would have the value of the property. So, if I have a property called "User_Name" with a value of "Bill" I would want it to show up in the...
5
2295
by: Joe | last post by:
Is there anyway to change the name or add a property to and existing class in .NET 1.1? For example if I have a property called Name and I want to change it to MyName. -Joe
1
11119
by: Jim M | last post by:
After learning that the 'subdatasheet name' property set to "" can adversely effect database speed, I wanted to send a small code snippent to my end users to reset the SubdatasheetName Property so they don't have to manually cycle through 35 or 40 tables and change the property. VBA help says: "To set the SubdatasheetName property by using Visual Basic, you must first either: -Set the property in table Design view by pointing to...
1
2099
by: j_mmtz | last post by:
Hi, i need to change the internal name of an application VB Net in visual studio 2005, but i can't find this option if it exists, please can somebody help me?. thanks.
7
1646
by: Nemisis | last post by:
Hi everyone, Can anyone tell me if it is possible to pass in a property of an object into a sub, and within that sub, find out the name of the item that was passed along with the property name?? Example would be ......Code Dim ObjA As New ObjectA
2
1366
Jezternz
by: Jezternz | last post by:
OK. I have made a function here that will suposedly go down the stylesheet and change particular properties. However I want to be able to make the property name defined when the function is called. Function: function changeRule(theNumber, property, value) { var theRules = new Array(); if (document.styleSheets.cssRules) { theRules = document.styleSheets.cssRules; } else if (document.styleSheets.rules) {
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10393
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
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
7664
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
6882
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();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
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
3
3015
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.