vb.net - Treeview - Event on Node Click but not Expansion in Visual Basic (VS 2012 V11) -


i'm trying make file in visual basic. i've decided go route of replicating old style files treeview panel, left, , richtextbox , on right, of form. (this set-up looks file in powershell exactly.

i'm trying make when treeview node single clicked richtextbox text change appropriate text. here code:

 private sub treeview_nodemouseclick(byval sender object, byval e treenodemouseclickeventargs) handles treeviewcontents.nodemouseclick         if e.node.text.equals("program help")             rtbhelp.text = environment.newline & "help text here."         end if          if e.node.text.equals("program getting started")             rtbhelp.text = environment.newline & "getting started text here"         end if      end sub 

the problem text change when clicking plus or minus located next treeview node. but, want emulate powershell behavior, clicking plus or minus expands or collapses nodes not change richtextbox text. when clicking on nodes name (text) should richtextbox textchange. have tried several methods none seem work. do?

this might late had same problem. used afterselect event. logically nodeclick event fired when 1 tries expand node since clicking on node expanding it. if 1 interested on selection done mouse necessary check if e.action = treeviewaction.bymouse.

private sub treeview_afterselect(byval sender object, byval e system.windows.forms.treevieweventargs) handles treeview.afterselect     if e.action = treeviewaction.bymouse         if e.node.text.equals("program help")           rtbhelp.text = environment.newline & "help text here."         end if          if e.node.text.equals("program getting started")             rtbhelp.text = environment.newline & "getting started text here"         end if     end if  end sub 

by using "if treeviewaction.bymouse ...", code under if statement excuted if 1 presses arrow-keys or mouse. first if statement important if mouse selection caught.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -