# DatagridView vs TreeView

This topic is 2247 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a program that scans source code for issues.

Currently:
Right now it outputs the information to a treegrid view, each main node being the problems name and each subnode being a source file.
When the user clicks on a file a seperate tree view shows information on the file, the problem, and how to fix it.

The only problem is when there are a large amount of problems it seems a little impractical to go through every node and expand each one and read the individual problems.

Proposed:
So I was thinking a better way to do it might possibly be a datagrid view.
I was thinking having the following columns "Issue" "File Name" "Code Snipplet".
This datagrid view would be connected to a dataset.
The only problem I see with this is that I won't have all of the nice icons that I have now associated with the pages.

Overall for my situation which would be the most practical and show the information the best?

I basically am just asking for some opinions on this before modifying all of this code.

CoderWalker

##### Share on other sites
If you store the image in the DB that you want along with the rest of the data then it is easy.

 private void createGraphicsColumn() { Icon treeIcon = new Icon(this.GetType(), "tree.ico"); DataGridViewImageColumn iconColumn = new DataGridViewImageColumn(); iconColumn.Image = treeIcon.ToBitmap(); iconColumn.Name = "Tree"; iconColumn.HeaderText = "Nice tree"; dataGridView1.Columns.Insert(2, iconColumn); } 

##### Share on other sites
It's kind of hard for me to arrive at an opinion on this without knowing anything about what the data is, how it's formatted, how I would typically want to browse it, and so on. I could see use cases where both options make sense, but since I don't know much about your tool, it's hard to think which one might be preferable.

• 10
• 9
• 48
• 12
• 10
• ### Forum Statistics

• Total Topics
631385
• Total Posts
2999705
×