ArrayList bound to DataGridView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vic

    ArrayList bound to DataGridView

    I have a ArrayList bound to a DataGridView.
    The objects in de arryalist have 5 propertie but i need only 3 of then in de
    datagridview.
    Cane somebody tell me how to prevent that some of the properties are not
    show.

    Best Regards
    Vic


  • Tom Shelton

    #2
    Re: ArrayList bound to DataGridView

    On 2008-11-10, Vic <vsergeant@tele net.bewrote:
    I have a ArrayList bound to a DataGridView.
    The objects in de arryalist have 5 propertie but i need only 3 of then in de
    datagridview.
    Cane somebody tell me how to prevent that some of the properties are not
    show.
    >
    Best Regards
    Vic
    >
    >
    The only way I know is to turn AutGenerateColu mns to false and then add the
    columns you want:

    myDataGridView. AutoGenerateCol unns = False

    Dim firstColumn As = new DataGridViewTex tBoxColumn()
    firstColumn.Nam e = "First Column"

    ' the name here is the name of the property of
    ' the object you want to be bound to this column
    firstColumn.Dat aPropertyName = "MyProperty "

    myDataGridView. Columns.Add(fir stColumn)

    ' rinse and repeat until all columns are added.


    HTH
    --
    Tom Shelton

    Comment

    • Vic

      #3
      Re: ArrayList bound to DataGridView

      Thx Tom for this.

      Maybe a second question.
      To bound a property to a column you indicate firstColumn.Dat aPropertyName =
      "MyProperty "
      Is this the only possibility? Isn't possible to use early binding?

      Vic


      "Tom Shelton" <tom_shelton@co mcastXXXXXXX.ne tschreef in bericht
      news:udrNr%233Q JHA.4824@TK2MSF TNGP02.phx.gbl. ..
      On 2008-11-10, Vic <vsergeant@tele net.bewrote:
      >I have a ArrayList bound to a DataGridView.
      >The objects in de arryalist have 5 propertie but i need only 3 of then in
      >de
      >datagridview .
      >Cane somebody tell me how to prevent that some of the properties are not
      >show.
      >>
      >Best Regards
      >Vic
      >>
      >>
      >
      The only way I know is to turn AutGenerateColu mns to false and then add
      the
      columns you want:
      >
      myDataGridView. AutoGenerateCol unns = False
      >
      Dim firstColumn As = new DataGridViewTex tBoxColumn()
      firstColumn.Nam e = "First Column"
      >
      ' the name here is the name of the property of
      ' the object you want to be bound to this column
      firstColumn.Dat aPropertyName = "MyProperty "
      >
      myDataGridView. Columns.Add(fir stColumn)
      >
      ' rinse and repeat until all columns are added.
      >
      >
      HTH
      --
      Tom Shelton

      Comment

      Working...