Results 1 to 3 of 3

Thread: Change column width of .Net DataGrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    15

    Change column width of .Net DataGrid

    Hello,

    I'm trying to use the datagrid control in .Net and so far I can't find the property to allow me to resize the columns. In VB6 I would simply use the .colwidth property...what is the .Net equivalent?

    Thanks,

    Sean

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    15

    Found it...

    DataGrid1.PreferredColumnWidth

  3. #3
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    be warned as I found out to my cost though, if you want to individually set the colum widths, you have to create a tablestyle and a column style, add the tablestyle to the datagrid and then use something like:

    dg1 = DataGrid1.TableStyles(0).GridColumnStyles(1)
    dg1.Width = 50

    where dg1 is the datagridcolumnstyle and the number in brackets after Gridcolumnstyles is the column number (starting from 0 so 1 is the second colum and the width is in pixels

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