I have a treeview with a single parent node (title) and 5 child nodes (name,address,city,state,zip)
I want the user to edit the 5 children, no problem.
However, after they edit let's say child node 0 I want the next node to be selected and ready to edit:
Now look at this code:
private
void tvCust_MouseDown(object sender, MouseEventArgs e)
{
TreeViewHitTestInfo hti = tvCust.HitTest(e.X, e.Y);
if (hti.Node != null)
{
if (hti.Node.Parent != null)
{
if (hti.Node.Parent.Text == "New Billing Or Site Address")
{
//hti.Node.BeginEdit();
}
else
tvCust.SelectedNode = hti.Node;
}
}
}
private void tvCust_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
{
if (e.Node.Parent.Text == "New Billing Or Site Address")
{
switch (e.Node.Index)
{
case 0:
e.Node.BackColor = System.Drawing.
Color.White;
tvCust.Nodes[0].Nodes[1].BeginEdit();
break;
default:
break;
}
}
}
The FIRST time I click in node 0, it calls the mousedown fine, THEN it calls afterlabeledit, followed by another mousedown. This only happens the first time. what the heck am I missing? TREEVIEWS ARGH.