Jump to content

Ajuda com TreeView


Seabra
 Share

Recommended Posts

Olá!

Tenho uma tabela em SQLServer com as seguintes colunas:

Fabrica------------Loja---------------Zona--------------------Maquina

------------------------------------------------------------------------------

EDP-------------AF1---------------Viseu----------------------Apilar

EDF------------AF2---------------Lisboa---------------------Horno

EDF------------AF1---------------Viseu----------------------Estufa

EDE------------AF2---------------Viseu----------------------Calcar

EDP------------AF3--------------Setubal--------------------Pintar

EDP------------AF1---------------Setubal-------------------Apilar

Pretendia ligar esta tabela a uma TreeView

Tenho que fazer vários filtros, mas não sei por onde começar.

alguém me pode ajudar?

Cumprimentos

Link to comment
Share on other sites

Ve se precebes:

            Dim Node1, Node2, Node3 As TreeNode

            Node1 = New TreeNode("Node 1")
            Node2 = Node1.Nodes.Add("SubNode 1")
            Node3 = Node2.Nodes.Add("SubNode 2")

            TreeView1.Nodes.Add(Node1)

Assim ficara algo do tipo:

Node 1

--- SubNode 1

--- -- Sub Node 2

Compr.

Making the impossible possible and pwing the world on db at a time.

Link to comment
Share on other sites

Desculpa mas não percebi!

Neste exemplo como faço?

Dim Node1, Node2, Node3 As TreeNode

           TreeView.ImageList = ImageList1

            Node1 = New TreeNode("Node 1")
            Node2 = Node1.Nodes.Add("SubNode 1")
            Node3 = Node2.Nodes.Add("SubNode 2")

            TreeView1.Nodes.Add(Node1)

Sabendo que tenho uma ImageList com 5 imagens diferentes.

Obrigado

Link to comment
Share on other sites

        Dim Node1, Node2, Node3 As TreeNode

        TreeView.ImageList = ImageList1

        Node1 = New TreeNode("Node 1", 0, 0)
        Node2 = Node1.Nodes.Add("SubNode 1", 1, 1)
        Node3 = Node2.Nodes.Add("SubNode 2", 1, 1)

        TreeView1.Nodes.Add(Node1)

Se reparares, repete o index (0,0 / 1,1 / 2/2)

Isto porque as TreeView permitem duas imagens para cada Node.. ou seja.. uma para quando o node esta expandido e outra para quando este fechado..

Compr.

Making the impossible possible and pwing the world on db at a time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.