c# - Is there a way to show datagridview rows in treeview-like form? -


I think I'm working on a C # application load a text file, parsed by parsing strings A DataGridView fills the value from. I want to display the selected row on the dotgrid view in the second panel, which has the same format as the treeview control. Is this also possible? If a treeview control, what can I use

Edit: this code, but it is throwing an NRE:

  public void dataGridViewParse_SelectionChanged (object sender, EventArgs e) {if (dataGridViewParse.SelectedRows.Count & gt; 0) {int id = Convert.ToInt32 (dataGridViewParse.SelectedRows [0] .Cells [ "No."] Value.ToString () .); TreeNode passfile = New TreeNode (DataGrid view mercury selected road [0]. Cell ["passfile"]. Value.ToString ()); TreeNode Cluster = New Treeode (Datagreat View Mercury. Selected Road [0]. Cell ["Clustormum"]. Value.ToString ()); TreeNode Creator Compact = New Treeode (Datagreat View Mercury Selected Road [0]. Cell ["Manufacturer Specific"]. Value.ToString ()); TreeNode Direction = New Treeode (Datagreat View Mercury. Selected Road [0]. Cell ["Direction"]. Value.ToString ()); TreeNode disableDefaultResponse = new TreeNode (dataGridViewParse.SelectedRows [0] .Cells [ "DisableDefaultResponse"] Value.ToString ().); TreeNode Reserved = New Treeode (Datagreat View Mercury Selected Road [0]. Cell ["Reserved"]. Value.ToString ()); TreeNode MakerCode = New Treeode (DataGridView Mercury selected Road [0] .Cell ["CreatorCode"]. Value.ToString ()); TreeNode transactionSequenceNum = new TreeNode (dataGridViewParse.SelectedRows [0] .Cells [ "TransactionSequenceNum"] Value.ToString ().); TreeNode Command ID = New Treeode (Datagreat View Mercury selected Road [0] .sec ["CommandId"]. Value.ToString ()); Tree node framePeload = New Treeode (Datagreat View Mercury. Selected Road [0] .sele ["FramePeload"]. Value.ToString ()); TreeView1.Nodes ["number"] Nodes.Add (id.ToString ()). TreeView1.Nodes ["pass / fail"] Nodes.Add (passFail). // Exception See Tree here 1. Node ["cluster"]. Nodes. Add (cluster); TreeView1.Nodes ["Manufacturer Specific"]. Nodes. Add (Manufacturer Specific); TreeView1.Nodes ["Direction"] Nodes.Add (Direction). Tree view 1. Node ["default response"]. Nodes. Add (Disabled Default Response); . TreeView1.Nodes ["safe"] Nodes.Add (reserved); TreeView1.Nodes ["Manufacturer Code"]. Nodes. Add (CreatorCode); Tree view 1. Node ["transaction sequence number"]. Nodes.ad (transaction finely); TreeView1.Nodes ["Command Identifier"] Nodes. Add (command id); Tree view 1. Node ["frame payload"]. Nodes. Add (framepailode); }}  

Yes, this is possible. Setup ads TreeView and then when the user makes a click DataGridViewRow populate its tree by counting through the columns of the data grid row.


Comments