473,386 Members | 1,766 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.

Class Design question

We use Public properties in our business classes to represent field
values from databases. So in Vb, I might have something like:

Public Property Emp_Id() As System.Decimal
Get
Return _Emp_Id
End Get
Set(ByVal value As System.Decimal)
_Emp_Id = value
End Set
End Property

So now it's easy enough for some code to create an instance of the
class and get or set the value. But I'd like to be able to get the
friendly name of a field, like a data dictionary. The business object
should be able to provide this friendly name to a form for example to
use as a label or maybe a grid column heading.

In my example above, I can reference Emp_Id like this:

Employee.Emp_Id

What I'd like to be able to do is create a way for me to store the
friendly name in the business class and access it in a similar way
like this perhaps:

Employee.Emp_Id.FriendlyName

Any ideas?

Jan 31 '07 #1
1 1060
An aggregate type (one that has more than one field or property) is either
going to be a structure or a class. So, you need to create a structure or a
class, rather than using a System.Decimal. For example, you could use a
structure that has a System.Decimal member and a string member.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"Will" <bk******@hotmail.comwrote in message
news:11*********************@a34g2000cwb.googlegro ups.com...
We use Public properties in our business classes to represent field
values from databases. So in Vb, I might have something like:

Public Property Emp_Id() As System.Decimal
Get
Return _Emp_Id
End Get
Set(ByVal value As System.Decimal)
_Emp_Id = value
End Set
End Property

So now it's easy enough for some code to create an instance of the
class and get or set the value. But I'd like to be able to get the
friendly name of a field, like a data dictionary. The business object
should be able to provide this friendly name to a form for example to
use as a label or maybe a grid column heading.

In my example above, I can reference Emp_Id like this:

Employee.Emp_Id

What I'd like to be able to do is create a way for me to store the
friendly name in the business class and access it in a similar way
like this perhaps:

Employee.Emp_Id.FriendlyName

Any ideas?

Jan 31 '07 #2

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

Similar topics

50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
13
by: Bryan Parkoff | last post by:
I have created three classes according to my own design. First class is called CMain. It is the Top Class. Second class and third class are called CMemory and CMPU. They are the sub-classes....
15
by: Steven T. Hatton | last post by:
The following may strike many of you as just plain silly, but it represents the kind of delelima I find myself in when trying to make a design decision. This really is a toy project written for...
3
by: fernandez.dan | last post by:
I'm still learning how to use Object Oriented concepts. I'm have a basic question dealing with design. I have two classes that deal with I/O pertaining to network and usb that inherit from an...
1
by: Alfonso Morra | last post by:
if I have a class template declared as ff: (BTW is this a partial specialization? - I think it is) template <typename T1, myenum_1 e1=OK, my_enum_2=NONE> class A { public: A(); virtual...
11
by: dimension | last post by:
If my intentions are to create objects that encapsulates data rows in a table, is it better to use a Struct or Class? Based on what i read, if my objects will simply have get and set methods,...
6
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is...
43
by: Tony | last post by:
I'm working with GUI messaging and note that MFC encapsulates the message loop inside of a C++ class member function. Is this somehow inherently less robust than calling the message loop functions...
6
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often...
29
by: Brad Pears | last post by:
Here is a simple OO design question... I have a Contract class. The user can either save an existing contract or they start off fresh with a blank contract, fill in the data and then save 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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
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
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,...

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.