views:

66

answers:

1

hi guys,

So basically i have 2 treeviews running next to each other, one shows a list of drugs that someone might be on the next shows the latests prescription date for that drug.

what i am trying to achieve is someway of when the user selects a drug in treeview A, it highlights that drugs latest prescribe date in treeview B, however my attempts havent been successfull yet and so i turn to you guys for help :)

this is the code i have tried in in the after select event of treeviewA

 int selected = mainTree.SelectedNode.Index;
 secondTree.SelectedNode = secondTree.Nodes[selected];

which did nothing basically..

i am open to ideas, if i am honest i would prefer to in someway have both the drug name and last prescribe date in the same treeview, this would make it much tidier, but i am not sure if u can have 2 trees next to each other

Any help is greatly appreciated

Vade

A: 

The reason you can't see any nodes selected is probably because by default the TreeView control will hide the current selection when the control has lost focus. If you add secondTree.HideSelection = false; to your code, you'll be able to see the effect that you want.

However, saying that I can't help but think that there may be a better way. Can't you use a label in place of the second TreeView? Clicking a drug in the first TreeView would then just show the last prescribed date in the Label?

nukefusion