Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Sum of the columns' FillWeight values cannot exceed 65535

$
0
0

HI All,

I know this question is been asked multiple times in this forum but I am still facing the problem.

I have looked at the following link.

http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/bd291e0c-dee8-45c1-bee1-54509fdf3c4f/

http://www.timvw.be/adding-datagridviewcolumns-lots-of-them/

But I am not able to find the solution to the problem. I am using VS2010 and I am trying to bind 900 columns.

The code looks like this:

 

DataGridViewColumn[] columns =newDataGridViewColumn[ds.Tables[0].Columns.Count];

dgTab.AutoGenerateColumns =

false;

 

for (int i = 0; i < columns.Length; ++i)

{

 

DataGridViewColumn column =newDataGridViewTextBoxColumn();

column.FillWeight = 1;

columns[i] = column;

}

 

this.dgTab.Columns.AddRange(columns);

dgTab.DataSource =

null;

dgTab.DataSource = ds.Tables[0];

 

=================================================================================================================

 If I set column.FillWeight = 0, I get run time error saying FillWeight cannot be 0. That why I have set it to 1.

Also, I have a row enter event where I  am trying to get the parentId

int participantID = Convert.ToInt32(dgTab.Rows[e.RowIndex].Cells["ParentID"].Value);

I get error saying:

Column named ParentID cannot be found.
Parameter name: columnName

I think the data is not getting binded to the grid properly. Please share the code which will resolve the problem.

 


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>