954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error on search button

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; }

MJV
Junior Poster in Training
67 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

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

JerryShaw
Posting Pro in Training
465 posts since Nov 2006
Reputation Points: 69
Solved Threads: 75
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You