Advertisement
some_yahoo

Untitled

Jun 10th, 2011
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. private void initializeColumnWidths()
  2. {
  3.     foreach (DataGridViewColumn Col in customerDataGridView.Columns)
  4.     {
  5.         if (Col is DataGridViewTextBoxColumn)
  6.         {
  7.  
  8.             if (Col.ValueType == typeof(System.String))
  9.             {
  10.                 int maxlen = customerDataset.customer.Columns[Col.DataPropertyName].MaxLength;
  11.                 Col.HeaderText += string.Format("({0})", maxlen);
  12.                 (Col as DataGridViewTextBoxColumn).MaxInputLength = maxlen;
  13.             }
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement