I have code that is giving me the following errors

The best overloaded method match for 'EstimatorC.EstimatorDataSet.QuoteCalcHeaderDataTable.this[int]' has some invalid arguments E:\VisualStudioProjects\EstimatorC\EstimatorC\Estimate.cs 1653 13 EstimatorCArgument '1': cannot convert from 'string' to 'int' E:\VisualStudioProjects\EstimatorC\EstimatorC\Estimate.cs 1653 46 EstimatorC

Code:

private void findBN_Click(object sender, EventArgs e) 
   {            string aFilter = "";    
                ////Search name starts with  
      aFilter = "Id=" + estfindTB.Text;  
        ////Create the filter string.   
     if (estfindTB.Text.Trim() == "") 
       {                aFilter = "";            }   
     else 
       {                aFilter = aFilter;            }
        ////Apply the filter. 
       estimatorDataSet.QuoteCalcHeader["estimateno"].DefaultView.RowFilter = aFilter;         } 

Edited 3 Years Ago by Reverend Jim: Fixed formatting

estimatorDataSet.QuoteCalcHeader["estimateno"]. <<== is estimateno correct ? does the QuoteCalcHeader accept a string as the indexer ?
What is QuoteCalcHeader ? (Type?)

You can ignore the code below, I think your problem is with indexing that QuoteCalcHeader object, but the formatting below might help you after resolving that issue, so I left it in this response.

private void findBN_Click(object sender, EventArgs e) 
{ 
    int num;
    string aFilter = string.Empty; 
    if( !string.IsNullOrEmpty(estfindTB.Text) && Int.TryParse(estfindTB.Text, out num) )
         aFilter = "Id="+estfindTB.Text;
  estimatorDataSet.QuoteCalcHeader["estimateno"].DefaultView.RowFilter = aFilter; }

// Jerry

This article has been dead for over six months. Start a new discussion instead.