Click here to Skip to main content
15,910,009 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# desperately need helps Pin
Professor Sharada Ulhas24-Oct-07 4:34
Professor Sharada Ulhas24-Oct-07 4:34 
GeneralRe: C# desperately need helps Pin
J4amieC24-Oct-07 4:43
J4amieC24-Oct-07 4:43 
GeneralRe: C# desperately need helps Pin
Mohd. Firdaus26-Oct-07 2:47
Mohd. Firdaus26-Oct-07 2:47 
QuestionHow to drop text at a cursor position Pin
Cmd.COM24-Oct-07 1:33
Cmd.COM24-Oct-07 1:33 
AnswerRe: How to drop text at a cursor position Pin
Mohib Sheth24-Oct-07 20:33
Mohib Sheth24-Oct-07 20:33 
GeneralRe: How to drop text at a cursor position Pin
Cmd.COM24-Oct-07 22:57
Cmd.COM24-Oct-07 22:57 
Questionis it possible to find List item belongings? Pin
c0ax_lx24-Oct-07 1:22
c0ax_lx24-Oct-07 1:22 
AnswerRe: is it possible to find List item belongings? Pin
Luc Pattyn24-Oct-07 1:32
sitebuilderLuc Pattyn24-Oct-07 1:32 
Hi,

this is how I see it:
- a Control can be shown in some Container, and Parent will reflect that;
there is only one Parent, since the Control is in one Container at most.

- an object (Control or other) can be part of many collections at the same time;
so there is no property that points from that object to the collection(s) it is in.

- if you somehow make sure an object is in exactly one of several collections, you can
reflect that fact in several ways, here are two of them:

(a) create a Hashtable or Dictionary, use the object/Control as key, and the collection
it belongs to as value; doing so, a single Hashtable/Dictionary lookup will return the
collection

(b) a Control has a Tag property that is not used by Windows or the .NET Framework;
it has type Object and can be used for whatever purpose you see fit. So you could store
a reference to the collection in that Tag.

Three more comments:
1. in both cases you would have to provide code to keep things correct (insert/replace
the Hashtable/Dictionary entry when the Control is inserted into or mode among collections
2. when using the Tag property or the Hashtable you would need to cast the value
to a Control (or a more specialized type such as Label) when you retrieve it.
3. The proposed ways avoid the explicit search at the expence of extra data; this data
redundancy could result in an inconsistent state. If you don't like that, the solution is
to search the collections, as you were mentioning.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google


GeneralRe: is it possible to find List item belongings? Pin
c0ax_lx24-Oct-07 1:48
c0ax_lx24-Oct-07 1:48 
GeneralRe: is it possible to find List item belongings? Pin
Pete O'Hanlon24-Oct-07 2:31
mvePete O'Hanlon24-Oct-07 2:31 
GeneralRe: is it possible to find List item belongings? Pin
c0ax_lx24-Oct-07 8:39
c0ax_lx24-Oct-07 8:39 
GeneralRe: is it possible to find List item belongings? Pin
Pete O'Hanlon24-Oct-07 9:09
mvePete O'Hanlon24-Oct-07 9:09 
QuestionHow to attach a document to our form in c#.net Pin
bobin scaria24-Oct-07 1:19
bobin scaria24-Oct-07 1:19 
AnswerRe: How to attach a document to our form in c#.net Pin
c0ax_lx24-Oct-07 2:08
c0ax_lx24-Oct-07 2:08 
QuestionOverriding a function Pin
sindhutiwari24-Oct-07 1:15
sindhutiwari24-Oct-07 1:15 
AnswerRe: Overriding a function Pin
Luc Pattyn24-Oct-07 1:44
sitebuilderLuc Pattyn24-Oct-07 1:44 
QuestionLoading and parsing a html-page Pin
Tomerland24-Oct-07 0:36
Tomerland24-Oct-07 0:36 
AnswerRe: Loading and parsing a html-page Pin
Spunky Coder24-Oct-07 0:48
Spunky Coder24-Oct-07 0:48 
GeneralRe: Loading and parsing a html-page Pin
Tomerland24-Oct-07 1:47
Tomerland24-Oct-07 1:47 
AnswerRe: Loading and parsing a html-page Pin
Anthony Mushrow24-Oct-07 0:59
professionalAnthony Mushrow24-Oct-07 0:59 
GeneralRe: Loading and parsing a html-page Pin
Tomerland24-Oct-07 1:49
Tomerland24-Oct-07 1:49 
QuestionLasso tool for free image selections Pin
Barbarus24-Oct-07 0:02
Barbarus24-Oct-07 0:02 
AnswerRe: Lasso tool for free image selections Pin
Christian Graus24-Oct-07 0:36
protectorChristian Graus24-Oct-07 0:36 
JokeRe: Lasso tool for free image selections Pin
Luc Pattyn24-Oct-07 2:02
sitebuilderLuc Pattyn24-Oct-07 2:02 
QuestionRe: Lasso tool for free image selections Pin
Barbarus24-Oct-07 3:06
Barbarus24-Oct-07 3:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.