472,347 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

am i using the tag property the right way? please take a look ...

I could do with something similiar, can you tell me if you think this
would work for me, and if there's any advantage in working with
controls
this way than how I currently am.

At the moment i'm using the treenodes and each treenode needs a unique
entry into my rich text box. After sitting at home with MSDN i've
managed to get this functionality by storing a RTF string in the tag
property of the treenode. On every 'before update' of the treeview I
save the current RTF string from the rich textbox to the tag property
of the selected node. On every 'after update' I pull in the RTF from
the selected tag property into the rich text box.
Would it be better for me to have a new class with a richtext property
or something? or is the way i'm doing it perfectly OK?
Am i right in thinking a new class would mean that i'd create new
objects which would have all the functionality of the treeview control,
all treeview properties etc... but also extra properties / methods that
I specify? If this is the case, would there be a property better suited
to storing richtext that I could create which is different to the
already provided tag property?

My treenode collection will have about 40 nodes, and each node will
have its own richtext associated with it eventually - the richtext is
typically 1-3 pages worth per node.

Should I be storing this info in a database instead of the tag
property? At the moment i'm serialising the treeview and saving to a
file, which conveniently captures the rich text entries too as i'm
storing them in the tag property.

Finally a previous post I was reading about creating your own objects
mentioned common
interface and polymorphism could someone explain this please, i've
never tried creating my own class from an already existing class
before.
Many Thanks.
Gary.

Mar 29 '06 #1
2 2063
Hi Gary,
Would it be better for me to have a new class with a richtext property
or something? or is the way i'm doing it perfectly OK?
It all depends. There are a couple of possible reasons for making a new
class. For example, reusability. If you anticipate reusing this class in a
similar way in the future, it might make sense to create a derived class
which includes the functionality you're specifying, and is extensible for
re-purposing. If, on the other hand, you don't, creating a new class might
be a waste of time. And keep in mind that designing a new class will be
time-consuming, if you design it right.
Am i right in thinking a new class would mean that i'd create new
objects which would have all the functionality of the treeview control,
all treeview properties etc... but also extra properties / methods that
I specify?
Pretty much, yes.
If this is the case, would there be a property better suited
to storing richtext that I could create which is different to the
already provided tag property?
The tag property, while very useful, is of type object. You would be able to
be more specific about what type you attach to a new property, and of
course, the tag property would still be availble for other possible uses.
Should I be storing this info in a database instead of the tag
property? At the moment i'm serialising the treeview and saving to a
file, which conveniently captures the rich text entries too as i'm
storing them in the tag property.
The word "database" has always been a stumbling block for a lot of people.
What is a database? In essence, it is a permanent storage mechanism for
data. That is, of course, what your file is. So, what you're really asking
is, should you substitute one sort of database for another?

The answer, again, depends upon several factors. Most commercial database
products store data in a tabular fashion. But from what you're describing,
your data is hierarchical in nature. While hierarchical data can be stored
in tablular fashion, it is somewhat complex to do so. On the other hand, if
you expect this to be a multi-user application, with many clients accessing
the same data, and possibly at the same time, a database server might suit
you better than your current solution.
Finally a previous post I was reading about creating your own objects
mentioned common
interface and polymorphism could someone explain this please, i've
never tried creating my own class from an already existing class
before.
This is a real can of worms, and it would take more time than I have to
explain it fully. Abstractly speaking, an interface is a mechanism for
access. In software, there are many kinds of interfaces. The user interface
is the most widely known; it provides a human-friendly mechanism for
accessing the functionality contained in a piece of software. A programming
interface is a mechanism that enables software to access the functionality
contained in a piece of software. The only real difference is what the
client-side of the interface "looks like" - how it works, that is.

In a programming interface, such as that exposed by a class, there are
publicly-available properties, methods, etc., for which the "signatures" are
known. That is, the type and number of parameters, the type of the return
value, etc. Taken even more abstractly, OOP provides interfaces that are not
classes at all, but simply definitions of the "signatures" of an interface.
While a class *has* its own interface, it may also *implement* an interface
that is not a class, but simply an interface. The purpose of such interfaces
is to gurantee a standard that is known to the client, or user. A client
doesn't necessarily have to know everything about a class to make use of it.
It may simply want to perform some common task with it. If it knows that the
class implements a certain interface, it can make method calls, use
properties, etc., without knowing anything at all about the class, other
than the fact that it implements the interface needed.

Polymorphism is a bit more difficult to define easily. The best and most
common examples are overloading and overriding. Overloading is when several
different methods (or functions) have the same name, but take different
parameters, and may yield entirely different results. For example:

String.IndexOf(string)
String.IndexOf(string, int)
String.IndexOf(string, int, int)

Overriding is the one that you may be thinking of here. That is when a
derived (inherited) class, which inherits a method or a property, does
something additional or different when that property or method is invoked.
For example, in a Windows Form application, you often override one of the
On-Event event methods in the base Form class. Usually, you begin by
executing the base class's method, and then perform some additional work,
such as handling a button click.

You may find the following article enlightening, for more information about
the 4 pillars of OOP:

http://codebetter.com/blogs/raymond....les/59908.aspx

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
<ga********@myway.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...I could do with something similiar, can you tell me if you think this
would work for me, and if there's any advantage in working with
controls
this way than how I currently am.

At the moment i'm using the treenodes and each treenode needs a unique
entry into my rich text box. After sitting at home with MSDN i've
managed to get this functionality by storing a RTF string in the tag
property of the treenode. On every 'before update' of the treeview I
save the current RTF string from the rich textbox to the tag property
of the selected node. On every 'after update' I pull in the RTF from
the selected tag property into the rich text box.
Would it be better for me to have a new class with a richtext property
or something? or is the way i'm doing it perfectly OK?
Am i right in thinking a new class would mean that i'd create new
objects which would have all the functionality of the treeview control,
all treeview properties etc... but also extra properties / methods that
I specify? If this is the case, would there be a property better suited
to storing richtext that I could create which is different to the
already provided tag property?

My treenode collection will have about 40 nodes, and each node will
have its own richtext associated with it eventually - the richtext is
typically 1-3 pages worth per node.

Should I be storing this info in a database instead of the tag
property? At the moment i'm serialising the treeview and saving to a
file, which conveniently captures the rich text entries too as i'm
storing them in the tag property.

Finally a previous post I was reading about creating your own objects
mentioned common
interface and polymorphism could someone explain this please, i've
never tried creating my own class from an already existing class
before.
Many Thanks.
Gary.

Mar 29 '06 #2
Thankyou for your time and considerable efforts. Your post has been
very enlightening and given me a lot to think about. Day by day i'm
moving closer to a more fuller understanding of Visual C# and .net (I
know i have a very long way to go.) - Thank's again you have helped
immeasurably!

Gary.

Mar 29 '06 #3

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

Similar topics

7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in...
22
by: Bradley | last post by:
Has anyone else noticed this problem? I converted the back-end to A2000 and the performance problem was fixed. We supply a 97 and 2000 version of...
6
by: Don Leverton | last post by:
Hi All, I've got a situation where I am developing an Access 97 app for a client, and am in the "beta testing" stage. I have split the app up,...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this...
7
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
11
by: Brent Ritchie | last post by:
Hello all, I have been using C# in my programming class and I have grown quite fond of C# properties. Having a method act like a variable that I...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The...
8
by: moondaddy | last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which has 3 content controls in it. each content control uses a style from a...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.