Click here to Skip to main content
15,890,609 members
Home / Discussions / C#
   

C#

 
GeneralRe: Workflow Management Pin
Keith Barrow26-Jul-11 20:38
professionalKeith Barrow26-Jul-11 20:38 
GeneralRe: Workflow Management Pin
V.26-Jul-11 22:28
professionalV.26-Jul-11 22:28 
QuestionHow to find a Node in treeview Pin
NarVish26-Jul-11 4:23
NarVish26-Jul-11 4:23 
AnswerRe: How to find a Node in treeview Pin
Richard MacCutchan26-Jul-11 4:52
mveRichard MacCutchan26-Jul-11 4:52 
AnswerRe: How to find a Node in treeview Pin
PIEBALDconsult26-Jul-11 8:44
mvePIEBALDconsult26-Jul-11 8:44 
AnswerRe: How to find a Node in treeview Pin
Shameel26-Jul-11 18:29
professionalShameel26-Jul-11 18:29 
GeneralRe: How to find a Node in treeview Pin
NarVish26-Jul-11 19:55
NarVish26-Jul-11 19:55 
AnswerRe: How to find a Node in treeview Pin
BillWoodruff27-Jul-11 20:18
professionalBillWoodruff27-Jul-11 20:18 
C# WinForms .NET 4.0 Client FrameWork, WinForms TreeView

Hi, Shameel gave you the answer you need ... you need to make sure a TreeNode Name (string) is used as the argument to TreeNodeCollection.Find ... but, since I've been working with the (original WinForms) TreeView this week, I'll include a few notes here from my own recent TreeView "brain top-up" I hope will be useful to you.

0. a Treeview NodeCollection is not a Generic Dictionary: you can have multiple Keys with the same Name (key) as well as Text (value). imho: it would be passing strange/nuts to have duplicate Name/Text (key, value) TreeNode objects with the same Parent node, or being children of the top-level TreeNodes object, but you can do it.

1. the result of TreeNodeCollection.Find will be an array of matching TreeNodes.

2. if you expect zero, one, or a known number, of matches to occur, or you just to plan to handle the first of potentially multiple matches, you can use the length of this array as an indexer for a switch statement.

Of course, if the Nodes of the TreeView are being created, added, on-the-fly, or updated real-time from some DataSource, and you have potentially an unknown number of duplicate Keys, and you need to take action based on all the matches.then you'll need to enumerate the result of Find if #matches > 1 ...

In the history of .NET WinForms, TreeView and its NodeCollection object came before Generic Dictionaries, and, with hindsight, in my humble opinion, it would have been better if the 'Name property of a TreeNode were referred to as the 'Key, and the 'Text property referred to as the 'Value.

With Linq, you can now can use the LookUp special form of Dictionary; for example: LookUp (implementing ILookUp) is the return type of such operators as ToLookUp, which also allows duplicate keys. I intend to add a brief CP 'Tip/Trick' on ToLookUp this week.

best, Bill
"Reason is the natural order of truth; but imagination is the organ of
meaning." C.S. Lewis

QuestionUpload file usin MTOM Pin
abbd26-Jul-11 0:11
abbd26-Jul-11 0:11 
AnswerRe: Upload file usin MTOM Pin
OriginalGriff26-Jul-11 9:12
mveOriginalGriff26-Jul-11 9:12 
QuestionOptimize the maximum number of threads Pin
devvvy25-Jul-11 22:58
devvvy25-Jul-11 22:58 
AnswerRe: Optimize the maximum number of threads Pin
BobJanova25-Jul-11 23:54
BobJanova25-Jul-11 23:54 
GeneralRe: Optimize the maximum number of threads Pin
Dave Kreskowiak26-Jul-11 1:59
mveDave Kreskowiak26-Jul-11 1:59 
GeneralRe: Optimize the maximum number of threads Pin
BobJanova26-Jul-11 7:33
BobJanova26-Jul-11 7:33 
GeneralRe: Optimize the maximum number of threads Pin
Dave Kreskowiak26-Jul-11 8:58
mveDave Kreskowiak26-Jul-11 8:58 
GeneralRe: Optimize the maximum number of threads Pin
BobJanova26-Jul-11 10:21
BobJanova26-Jul-11 10:21 
GeneralRe: Optimize the maximum number of threads Pin
Dave Kreskowiak26-Jul-11 10:32
mveDave Kreskowiak26-Jul-11 10:32 
QuestionSorting on column, using mvccontrib lib [modified] Pin
omgerik25-Jul-11 22:42
omgerik25-Jul-11 22:42 
AnswerRe: Sorting on column, using mvccontrib lib Pin
omgerik26-Jul-11 2:08
omgerik26-Jul-11 2:08 
QuestionCreat New Security Group At AD Pin
treuveni25-Jul-11 21:33
treuveni25-Jul-11 21:33 
SuggestionRe: Creat New Security Group At AD Pin
Shameel25-Jul-11 23:54
professionalShameel25-Jul-11 23:54 
GeneralRe: Creat New Security Group At AD Pin
treuveni25-Jul-11 23:57
treuveni25-Jul-11 23:57 
GeneralRe: Creat New Security Group At AD Pin
Shameel27-Jul-11 1:52
professionalShameel27-Jul-11 1:52 
AnswerRe: Creat New Security Group At AD Pin
Dave Kreskowiak26-Jul-11 1:53
mveDave Kreskowiak26-Jul-11 1:53 
GeneralRe: Creat New Security Group At AD Pin
treuveni26-Jul-11 4:57
treuveni26-Jul-11 4:57 

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.