I prepared an example of how to do a Master Detail where we will use Treeview control which group the products by category, we will use the TreeView and DataGridView.
Next Demo estructaremos our solution as follows:
Implementing class Connection:
![](http://photos1.blogger.com/blogger2/1703/2811/320/00_.jpg)
Connection Script class at the beginning of our script we need to include or add namespaces:
![](http://photos1.blogger.com/blogger2/1703/2811/320/01.jpg)
Class Connection:
![](http://photos1.blogger.com/blogger2/1703/2811/400/02.jpg)
Implementing
Class Querys:
![](http://photos1.blogger.com/blogger2/1703/2811/320/03_.jpg)
Querys Script class at the beginning of our script we need to include or add the namespaces:
![](http://photos1.blogger.com/blogger2/1703/2811/320/03.jpg)
![](http://photos1.blogger.com/blogger2/1703/2811/320/04_1.jpg)
method Creating a DataTable type - CategoriaDistinct: Creating
![](http://photos1.blogger.com/blogger2/1703/2811/400/04_2.0.jpg)
![](http://photos1.blogger.com/blogger2/1703/2811/400/04_3.0.jpg)
For our winforms, add a Treeview (tvxGrupos). The Treeview will allow us to group the products by category, in this case we will use the Northwind database.
![](http://photos1.blogger.com/blogger2/1703/2811/320/00.1.jpg)
the beginning of our script we need to include or add the namespaces:
![](http://photos1.blogger.com/blogger2/1703/2811/320/05.jpg)
Script:
We will create a method
![](http://photos1.blogger.com/blogger2/1703/2811/320/06.jpg)
CargarNodos:
![](http://photos1.blogger.com/blogger2/1703/2811/400/07.2.jpg)
Form1:: Load
![](http://photos1.blogger.com/blogger2/1703/2811/400/08.jpg)
Now press the F5 and displayed our Form1:
![](http://photos1.blogger.com/blogger2/1703/2811/320/final.jpg)
I hope you find it useful this example and put it into practice. See
.
0 comments:
Post a Comment