Results 1 to 2 of 2

Thread: How to set a grid column width?

  1. #1

    Thread Starter
    Lively Member neodatatype's Avatar
    Join Date
    Aug 2002
    Location
    Italy
    Posts
    103

    How to set a grid column width?

    Hi all!

    With

    DataGrid1.PreferredColumnWidth = DefaultWidth

    I can set the default starting width for each column.

    But How can I set a width for a single Column?

    Thank you!
    > NeoDataType.net <

    Try my Free .Net Reporting Tool!

  2. #2
    New Member
    Join Date
    Feb 2003
    Location
    Colorado
    Posts
    10
    // create table style
    foreach(DataTable t in data.Tables)
    {
    dataGridTableStyle1.MappingName = t.TableName;
    dataGrid1.TableStyles.Add(dataGridTableStyle1);
    }

    dataGrid1.SetDataBinding(data, "table");
    DBs.Close();

    // set the column widths
    GridColumnStylesCollection myGridColumns;
    myGridColumns = dataGrid1.TableStyles[0].GridColumnStyles;
    myGridColumns[0].Width = 90;
    myGridColumns[1].Width = 200;
    myGridColumns[2].Width = 75;
    myGridColumns[3].Width = 75;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width