VB.NET TreeView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maignanamurthy
    New Member
    • Aug 2007
    • 12

    VB.NET TreeView

    I have one table in sqldatabase.
    The structure is
    Id Title ParentId
    1 flower 0
    2 color 0
    3 rose 1
    4 jasmine 1
    5 red 2
    6 green 2
    7 white rose 3
    8 light rose 3

    this is the sample structure of my table.
    i want to load the above table of content into my vb.net form in the TREEVIEW
    format.

    how to do this work.
    pls help , uurrrrgggggeeee nnnnttt.

    thanks in advance
    Maignanamurthy. RA
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to write a self join using ID and PAENTID fields.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Moving to the MS SQL forum....

      Comment

      • maignanamurthy
        New Member
        • Aug 2007
        • 12

        #4
        Originally posted by debasisdas
        You need to write a self join using ID and PAENTID fields.
        hai friend,
        thanks for reply,

        but i want the exact code for populate the treeview in vb.net from sqldatabase.

        thanks in advance

        Comment

        • maignanamurthy
          New Member
          • Aug 2007
          • 12

          #5
          Originally posted by pbmods
          Moving to the MS SQL forum....
          hai friend,

          thanks for your reply,

          but i want the code in vb.net to populate the treeview from sqldatabase
          thanks in advance

          Comment

          • maignanamurthy
            New Member
            • Aug 2007
            • 12

            #6
            if anybody will help me, its a great help,

            normally The datagridview column types allow only
            textbox,Combobo x,checkbox,butt on,linkbutton and image button in vb.net2005.
            but
            i want to add DateTimeColumn into my datagridview,
            i am using vb.net 2005

            thanks in advance
            uuurrrgggeeennn ttt.

            Comment

            • Purple
              Recognized Expert Contributor
              • May 2007
              • 404

              #7
              Hi given this is urgent and we appear to have sort the SQL side I am going to move the post into the VB forum where on the the experts with significantly more experience of VB treeview will be able to assist you further.

              Purple

              MODERATOR

              Comment

              • hariharanmca
                Top Contributor
                • Dec 2006
                • 1977

                #8
                Originally posted by maignanamurthy
                if anybody will help me, its a great help,

                normally The datagridview column types allow only
                textbox,Combobo x,checkbox,butt on,linkbutton and image button in vb.net2005.
                but
                i want to add DateTimeColumn into my datagridview,
                i am using vb.net 2005

                thanks in advance
                uuurrrgggeeennn ttt.
                Let tvCmd is a Treeview
                [CODE=vb]
                Dim MainNode As Node, SubNode As Node
                Set MainNode = tvCmd.Nodes.Add (, , IDStringKey, strTextToShow)[/CODE]
                for child node
                [CODE=vb]Set ChildNode = tvCmd.Nodes.Add (IDStringKey, tvwChild, IDStringKey, strTextToShow)[/CODE]

                This is an VB 6.0 code. just try with VB.Net.
                (I am not sure. Code not tested in VB.Net)

                Comment

                • Purple
                  Recognized Expert Contributor
                  • May 2007
                  • 404

                  #9
                  Thanks hariharanmca

                  Purple

                  Comment

                  • hariharanmca
                    Top Contributor
                    • Dec 2006
                    • 1977

                    #10
                    Originally posted by Purple
                    Thanks hariharanmca

                    Purple
                    Vb code and VB.Net code are more or less seem to be same. But there will be some changes required.

                    Comment

                    • maignanamurthy
                      New Member
                      • Aug 2007
                      • 12

                      #11
                      Problem in datagridview

                      i am using vb.net 2005
                      i have one datagridview in my form. it has some columns like

                      EmployeeId, EmployeeName,Ba sicSalary,Allow ences,TotalAmou nt.

                      my problem is the above said datagridview columns realigned automatically, like

                      (EmployeeName,T otalAmount,Allo wences,Employee Id,Ba sicSalary.)

                      at design time and also run time.
                      this problem occur in other forms in my project also.

                      What is the Problem Here?
                      How to Solve this?

                      Comment

                      • QVeen72
                        Recognized Expert Top Contributor
                        • Oct 2006
                        • 1445

                        #12
                        Hi,

                        how r u populating the datagridview..?
                        Populate using and SQL Statement and a Reader.
                        Change the Order of fields in SQL Statement. The same order will be reflected in ur DataGrid.
                        If u use * in SQL statement or or only Table name, , then the fields will be in the Order of Creation of fields.

                        REgards
                        Veena

                        Comment

                        • hariharanmca
                          Top Contributor
                          • Dec 2006
                          • 1977

                          #13
                          I think you are looking for merge column in grid?

                          Comment

                          Working...