Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Populate Property Grid with Datatable rows

Populate Property Grid with Datatable rows

Scheduled Pinned Locked Moved Visual Basic
csstutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    danasegaranea
    wrote on last edited by
    #1

    Hi all, Can we able to populate a property grid using a A datatabel For example, Like this PropertyGrid1.SelectedObject=Datatable1 or some any other method exist Thanks in Advance Dana

    D V 2 Replies Last reply
    0
    • D danasegaranea

      Hi all, Can we able to populate a property grid using a A datatabel For example, Like this PropertyGrid1.SelectedObject=Datatable1 or some any other method exist Thanks in Advance Dana

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      A property grid simply doesn't work that way. You can't give it a bunch of database rows and expect it to display them. A PropertyGrid control shows you the public properties of an object, like an instance of a TextBox, Label, DataGridView, ... It does NOT show the rows of a database table. For that, you'd need to use a DataGridView, or some other bindable grid control.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      • D danasegaranea

        Hi all, Can we able to populate a property grid using a A datatabel For example, Like this PropertyGrid1.SelectedObject=Datatable1 or some any other method exist Thanks in Advance Dana

        V Offline
        V Offline
        visualhint
        wrote on last edited by
        #3

        Hi Dana, You can put whatever you want in a PropertyGrid as long as you write a class that will publish the properties you want. It has to implement ICustomTypeDescriptor. If you drop it to the SelectedObject property, you will see the custom properties. With .Net 2.0 you can also use the TypeDescriptionProvider so that you don't have to modify your existing class (the DataTable) to make it implement ICustomTypeDescriptor. You will find some resources about this subject on the PropertyGrid Resource List. If a commercial component is an option for you, you have also Smart PropertyGrid. It has a mode where you can simply call AppendProperty-like methods and fill the grid completely dynamicall without having to build separate TypeDescriptor classes. I hope this helps.

        Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker

        D 1 Reply Last reply
        0
        • V visualhint

          Hi Dana, You can put whatever you want in a PropertyGrid as long as you write a class that will publish the properties you want. It has to implement ICustomTypeDescriptor. If you drop it to the SelectedObject property, you will see the custom properties. With .Net 2.0 you can also use the TypeDescriptionProvider so that you don't have to modify your existing class (the DataTable) to make it implement ICustomTypeDescriptor. You will find some resources about this subject on the PropertyGrid Resource List. If a commercial component is an option for you, you have also Smart PropertyGrid. It has a mode where you can simply call AppendProperty-like methods and fill the grid completely dynamicall without having to build separate TypeDescriptor classes. I hope this helps.

          Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker

          D Offline
          D Offline
          danasegaranea
          wrote on last edited by
          #4

          Hi Nicolas, Thanks for your reply Can u please brief about this one With .Net 2.0 you can also use the TypeDescriptionProvider so that you don't have to modify your existing class (the DataTable) to make it implement ICustomTypeDescriptor Thanks to Dave also :) Dana

          V 1 Reply Last reply
          0
          • D danasegaranea

            Hi Nicolas, Thanks for your reply Can u please brief about this one With .Net 2.0 you can also use the TypeDescriptionProvider so that you don't have to modify your existing class (the DataTable) to make it implement ICustomTypeDescriptor Thanks to Dave also :) Dana

            V Offline
            V Offline
            visualhint
            wrote on last edited by
            #5

            The best paper for that is http://msdn.microsoft.com/msdnmag/issues/05/05/NETMatters/. But read the first part too: http://msdn.microsoft.com/msdnmag/issues/05/04/NETMatters

            Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups