Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
sorry I have a treeview ıtem and has some operatıons name
for ex:1 Customer
2 Sale
3 Product

I click Custumer operatıon and this form open.I work on this form and I close this form.

Again I want to open customer operatıon form isnt open.if you want to open this form fırst you should click sale operatıon and then agaın you should clıck customer operatıon.

how can solve thıs problem?
my frıend said there ıs delegate property but ı dont know.
Posted
Updated 14-Apr-10 4:02am
v2

There are two ways that I can think of:

1. Disabling the nodes which cannot be used or
2. Keeping track of last opened form in the form containing the tree view and if the user opens a form which he should not, display a message.
 
Share this answer
 
Tell me if I am wrong, but it sounds like you have a ListView. You click on one ListViewItem and it opens up a form. But if you want to open that form again, you have to select a different item first.

My guess is that you have hooked the SelectedIndexChanged event. If that's the case, then the event will only fire when the selection changes. This means that because Customer is already selected, clicking it again doesn't change the selection.

Instead of using SelectedIndexChanged, use the MouseClick event. Then, first check to see if an item is selected, and if it is, open it's form.

Or, at the end of the SelectedIndexChanged event handler, run listView1.SelectedIndices.Clear();. This will ensure that everytime you go to click, the SelectedIndexChanged event will fire. That will also not show the highlighting on an item for the user...which sounds like what you might want.

Are you using SelectedIndexChanged?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900