CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2007
    Posts
    68

    FillWeight values cannot exceed 65535.

    I have a datagrid which contains 750 columns. When I try to assign it to datasource, I get the following error

    An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll

    Additional information: Sum of the columns' FillWeight values cannot exceed 65535.



    My code is as follows

    Public TaView As DataView
    Dim table As DataTable = New DataTable

    for i = 0 to 750
    table.Columns.Add(i.ToString())
    Next

    frmDatagrid.TaView = New DataView(table)
    frmDatagrid.dataView.DataSource = frmDatagrid.TaView 'The crash happens here


    I think I need to SetWeight to 1 for all columns. But how can it be done before assigning to datasource.

  2. #2
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: FillWeight values cannot exceed 65535.

    Here's a good link giving somewhat of a solution:

    http://social.msdn.microsoft.com/for...-54509fdf3c4f/

    "You'll need to set AutoGenerateColumns to false and manually add the columns"

    Looks like grid views (and DGV) were not designed for a large collection of columns.

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

Featured