title: C# Datagridview Column Name in Switch
body: <p>I am trying to validate my cells pending on what cell they are in when the dataerror fires for my datagridview.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
  {
    if (_licDataSet.LicenseFileTable.Rows(e.RowIndex).Columns(e.ColumnIndex) == "test")
  
      switch (dataGridView1.CurrentCell.OwningColumn.Name)
      {
        case "AllowAsRemoteDesktopColumn" :
          // do not think there are any checks for this column
          // we'll find out shortly though!
          break;
        case dataGridView1.CurrentCell.OwningColumn.Name : 
          // ^^^ this errors with "A constant value is expected"
          // do something
          break;
      }
  }
  </code></pre>
  
  <p>I am erroring at the ^^^ position as you can see from the message.</p>
  
  <p>What am I doing wrong? I would think that the owningcolumn name was constant at this point...?</p>
  
  <p>Help!</p>
  
  <p><em><strong></em>***<em></strong> EDIT <strong></em>***<em></strong>
  How do I get the column name of the current cell is my question if the above doesn't work?</em>*</p>