Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: Design Notepad with Forms Pin
help as an alias13-Aug-07 21:40
help as an alias13-Aug-07 21:40 
QuestionTreeView Control problem Pin
Adrian Soon13-Aug-07 17:27
Adrian Soon13-Aug-07 17:27 
AnswerRe: TreeView Control problem Pin
Luc Pattyn13-Aug-07 17:46
sitebuilderLuc Pattyn13-Aug-07 17:46 
GeneralRe: TreeView Control problem Pin
Adrian Soon13-Aug-07 19:54
Adrian Soon13-Aug-07 19:54 
AnswerRe: TreeView Control problem Pin
Hessam Jalali13-Aug-07 22:05
Hessam Jalali13-Aug-07 22:05 
GeneralRe: TreeView Control problem [modified] Pin
Adrian Soon13-Aug-07 22:57
Adrian Soon13-Aug-07 22:57 
GeneralRe: TreeView Control problem Pin
Hessam Jalali13-Aug-07 23:02
Hessam Jalali13-Aug-07 23:02 
GeneralRe: TreeView Control problem Pin
Hessam Jalali14-Aug-07 0:31
Hessam Jalali14-Aug-07 0:31 
when you click on the node it's not going to expand or checked ,it's just clicked and for expanding them you must click on the + sign not the node so the click event would not be invoked but the BeforeExpand event would as beforeCheck event for checkboxes

So there is no way to find the check or expand with click event (I think your problem was here)
but with other four events I said before you can.

if you need them to call the same method with expanding-checking and clicking you can do this

public Form1()
{
    InitializeComponent();
    this.treeView1.BeforeExpand += new TreeViewCancelEventHandler(treeView1_comb);
    this.treeView1.BeforeCheck += new TreeViewCancelEventHandler(treeView1_comb);
    this.treeView1.Click += new EventHandler(treeView1_comb);
    this.treeView1.BeforeCollapse += new TreeViewCancelEventHandler(treeView1_comb);

}


void treeView1_comb(object sender, EventArgs e)
{
    if (e is TreeViewCancelEventArgs)
    {
        TreeViewCancelEventArgs te = e as TreeViewCancelEventArgs;

        if (te.Action == TreeViewAction.Expand)
        {
            /*node expanded*/
            MessageBox.Show("On Expand");
        }
        else if (te.Action == TreeViewAction.Collapse)
        {
            /*node Collapsed*/
            MessageBox.Show("On Collapse");
        }
        else if (te.Action == TreeViewAction.ByKeyboard || te.Action == TreeViewAction.ByMouse)
        {
            /*node checked*/
            MessageBox.Show("On Check");
        }

    }
    else
    {
        //the node is just clicked
        MessageBox.Show("On Click");
    }
}


as you see ,there is single method associated to four events for four different signals

and you can simply do this with After events ,just change TreeViewCancelEventArgs to
TreeViewEventArgs and associate after events instead of before events

hope this one Help
GeneralRe: TreeView Control problem Pin
Adrian Soon14-Aug-07 16:01
Adrian Soon14-Aug-07 16:01 
GeneralRe: TreeView Control problem [modified] Pin
Hessam Jalali16-Aug-07 20:42
Hessam Jalali16-Aug-07 20:42 
GeneralRe: TreeView Control problem Pin
Adrian Soon16-Aug-07 21:43
Adrian Soon16-Aug-07 21:43 
GeneralRe: TreeView Control problem Pin
Hessam Jalali16-Aug-07 21:52
Hessam Jalali16-Aug-07 21:52 
GeneralRe: TreeView Control problem Pin
Adrian Soon17-Aug-07 4:43
Adrian Soon17-Aug-07 4:43 
GeneralRe: TreeView Control problem Pin
Hessam Jalali17-Aug-07 6:04
Hessam Jalali17-Aug-07 6:04 
QuestionExplain: "Store by value instead of by reference" Pin
Richard Blythe13-Aug-07 15:50
Richard Blythe13-Aug-07 15:50 
AnswerRe: Explain: "Store by value instead of by reference" Pin
Luc Pattyn13-Aug-07 16:23
sitebuilderLuc Pattyn13-Aug-07 16:23 
GeneralRe: Explain: "Store by value instead of by reference" Pin
Richard Blythe13-Aug-07 16:49
Richard Blythe13-Aug-07 16:49 
GeneralRe: Explain: "Store by value instead of by reference" Pin
Luc Pattyn13-Aug-07 17:40
sitebuilderLuc Pattyn13-Aug-07 17:40 
QuestionTough ActiveX question Pin
newb2vb13-Aug-07 15:37
newb2vb13-Aug-07 15:37 
QuestionConsuming a Delphi COM EXE in Visual Studio C# App Pin
alias4713-Aug-07 14:59
alias4713-Aug-07 14:59 
Questionhow to detect remote input in c#? Pin
Inam Jameel13-Aug-07 13:29
Inam Jameel13-Aug-07 13:29 
AnswerRe: how to detect remote input in c#? Pin
Liam O'Hagan13-Aug-07 20:32
Liam O'Hagan13-Aug-07 20:32 
QuestionHtmlEncode Pin
vfhgujaqwe13-Aug-07 12:02
vfhgujaqwe13-Aug-07 12:02 
AnswerRe: HtmlEncode Pin
Christian Graus13-Aug-07 13:38
protectorChristian Graus13-Aug-07 13:38 
QuestionConverting Excel File to XML Pin
T4AMD13-Aug-07 9:47
T4AMD13-Aug-07 9:47 

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.