John

John

  • NA
  • 1
  • 1.4k

Triggering event when mouse is clicked once

Aug 11 2011 1:59 PM
I have a code that triggers a messagebox when I click on a node in a treeview. Problem is, it only triggers when I click twice. Not the well known double click but I mean two clicks have to happen. I could click once, wait 5 minutes and click again and then messagebox pops up. Is there a way that I could alter my code to show the messagebox when I click once instead of twice? This is what I have as my current code:

if (e.Button == MouseButtons.Left)
            {
                string NodeName = treeSidebar.SelectedNode.Text;
                foreach (KeyValuePair<string, string> kvp in RSS.list)
                {
                    string name = kvp.Key;
                    string url = kvp.Value;
                    if (NodeName == name)
                    {
                        MessageBox.Show(url);
                    }
                }
            }

Answers (1)