如何在vb.net中创建分层数据网格视图 [英] how can I create a hierarchical datagridview in vb.net

查看:42
本文介绍了如何在vb.net中创建分层数据网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有

我有2张桌子

部门和员工

我想在VB.NET中创建一个显示部门的datagridview ,当您点击某个部门时,它将展开并显示其员工如下:



+部门1

+部门2

- 部门3

Emp 1

Emp 2

Emp 3

+部门4

+部门5



你能帮我吗

解决方案

< blockquote>前段时间我发现了一个我非常喜欢的控件,它可以帮到你。抱歉,它不是基于网格视图,而是基于列表视图。尽管如此,它可能足以满足您的目的。请参阅此CodeProject文章:



虚拟模式TreeListView [ ^ ]。



由于一些小错误,您将面临构建此代码的一些问题。请参阅我对文章的评论 - 我解释如何修复它们;并且作者答应我改进/修复代码并发布固定版本。



祝你好运,

-SA


还有一个直接从DataGridView继承的控件。它被称为TreeGridView,由Mark Rideout开发:



http://blogs.msdn.com/b/markrideout/archive/2006/01/08/customizing -the-datagridview-to-support-expanding-collapsing-ala-treegridview.aspx [ ^ ]



另请查看Mark'博客上的评论,它们包含一些错误修正以及许多改进。


我想你不能用fridview做到这一点!!!! !!

Dear all
I have 2 tables
Department and employees
I want to create one datagridview in VB.NET that shows the departments, and when you click on a department, it will be expanded and displays its employees as the following:

+ Dept 1
+ Dept 2
- Dept 3
Emp 1
Emp 2
Emp 3
+ Dept 4
+ Dept 5

Can you help me please

解决方案

A while ago I found one control which I liked very much and it could help you. Sorry, it''s based not on the grid view but on the list view. Nevertheless, it could be good enough for your purpose. Please see this CodeProject article:

Virtual Mode TreeListView[^].

You will face some problems building this code due to some minor bug. Please see my comment to the article — I explain how to fix them; and the author promised me to improve/fix the code and post a fixed version.

Good luck,
—SA


There''s also a control which directly inherits from DataGridView. It''s called TreeGridView and is developed by Mark Rideout:

http://blogs.msdn.com/b/markrideout/archive/2006/01/08/customizing-the-datagridview-to-support-expanding-collapsing-ala-treegridview.aspx[^]

Check also the comments on Mark''s blog, they contains a few bugfixes and also lots of improvements.


i think u can not do this with fridview !!!!!!


这篇关于如何在vb.net中创建分层数据网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆