RE: Accessing DataGrid column properties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VEQgaXMgUFNQ?=

    RE: Accessing DataGrid column properties

    Asuming that you have a DataGrid DG - then

    DG.columns[0].ItemStyle.Widt h = 100;
    DG.columns[0].Visible = true;

    should do the trick. You can also use the column name instead of the column
    number as an index into the collection of columns.

    Is that what you need?


    "Eric B." wrote:
    How do I access the properties of DataGrid columns that were created from a
    DataTable source? I need to format the column sizes and make some invisible.
    >
    Thanks,
    >
    Eric B.
    >
  • Eric B.

    #2
    Re: Accessing DataGrid column properties

    "TD is PSP" <TDisPSP@discus sions.microsoft .comwrote in message
    news:DE321A7B-7562-41AB-8C2D-695548D451E3@mi crosoft.com...
    Asuming that you have a DataGrid DG - then
    >
    DG.columns[0].ItemStyle.Widt h = 100;
    DG.columns[0].Visible = true;
    >
    should do the trick. You can also use the column name instead of the
    column
    number as an index into the collection of columns.
    >
    Is that what you need?
    >
    >
    "Eric B." wrote:
    >
    >How do I access the properties of DataGrid columns that were created from
    >a
    >DataTable source? I need to format the column sizes and make some
    >invisible.
    >>
    >Thanks,
    >>
    >Eric B.

    Yes thanks!

    Now if I can figure how to set a tristate value programmaticall y...
    Resizable wont take a bool or an int, hmm.

    Cannot implicitly convert type 'bool' to
    'System.Windows .Forms.DataGrid ViewTriState'

    Eric B.

    Comment

    Working...