Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WinForms: Editing TreeView Nodes
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
WinForms: Editing TreeView Nodes
Divers
Thread ID:
01473735
Message ID:
01473735
Vues:
84
I'm trying to let my user edit directly in a treeview node. The Price node has the text "Price $ 0.00".

First, on every node's Tag property is an instance of this class:
public class csNodeInfo
{
    public int RowId { get; set; }
    public NodeType Type { get; set; }
    public int ProductId { get; set; }
    public string Product_Series { get; set; }
    public string Product_Name { get; set; }
    public string Product_Number { get; set; }
    public string Category {get; set;}
    public int PartId { get; set; }
    public string Part_Number {get; set;}
    public string Part_Description {get; set;}
    public string Tribal { get; set; }
    public bool IsTribalSelected { get; set; }
    public decimal PartPrice { get; set; }
    public int QuantityReq { get; set; }
    public int PartRatio { get; set; }
    public int WhseQty1 { get; set; }
    public int WhseQty2 { get; set; }
}
First, when the node is selected I do this:
csNodeInfo NodeInfo = (csNodeInfo)Node.Tag;
cmdPrice.Enabled = (NodeInfo.Type == NodeType.Price);
Clicking the node, and the Click event of cmdPrice does this:
TreeNode Node = tvwResults.SelectedNode;
Node.BeginEdit();
Then in BeforeLabelEdit I do this:
decimal Price = 0.00M;
csNodeInfo NodeInfo = (csNodeInfo)Node.Tag;

foreach (DataRow Row in csCOSApp.ActiveProject.dsDataStore.Tables[0].Rows)
{
    if ((int)Row["RowId"] == NodeInfo.RowId)
    {
        Price = (decimal)Row["PartPrice"];
        break;
    }
}

Node.Text = Price.ToString();
Now here's where the problem presents. As soon as the node gets the focus the text reverts back from "0" to "Price $ 0.00". EndEdit has not been called at this point.

If I put this after the last line above:
MessageBox.Show(Node.Text);
It shows "0", yet the actual displauy value is "Price $ 0.00".

Anyone know what's wrong here?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform