Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data filter

Status
Not open for further replies.

MJV57

Programmer
Apr 18, 2009
87
CA
Im getting the following errors when trying the code below. Please note estimateno is an int value in the table. Any help would be greatly appreciated.


Error:

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 = estfindTB.Text;

////Create the filter string.

if (estfindTB.Text.Trim() == "")
{
aFilter = "";
}
else
{
aFilter = aFilter;
}

////Apply the filter.
estimatorDataSet.QuoteCalcHeader.["estimateno"].DefaultView.RowFilter = aFilter;
}
 
Covert aFilter to an Int.

change the last bit to int.parse(afilter) or make aFilter an int in the first place
 
Thanks pbail1. I changed the code as follows but I get the same errors? Any suggestions?


private void findBN_Click(object sender, EventArgs e)
{

int aFilter ;

////Search name starts with

aFilter = Convert.ToInt32(estfindTB.Text);

////Create the filter string.

if (estfindTB.Text.Trim() == "")
{
aFilter = "";
}
else
{
aFilter = aFilter;
}

////Apply the filter.
estimatorDataSet.QuoteCalcHeader["estimateno"].DefaultView.RowFilter = aFilter;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top