We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Find Replace with custom cell format

Hello,

I tried to implement Find Replace by GridFindReplaceDialogSink as sample, I found trouble for any cell with custom format like "#,###.##"
I have to enter '3,000' to find cell value of 3000

Regards,
Harry


2 Replies

AD Administrator Syncfusion Team March 19, 2008 12:47 AM UTC

Hi Harry,

Thank you for interest in Syncfusion products.

Please try the code below to solve this issue.

private void button1_Click_1(object sender, EventArgs e)
{
double t = Convert.ToDouble(this.textBox1.Text);
String s_text=String.Format("{0:#,####}", t);
textSearchInGroup(s_text);
}
GridCurrentCell cc;
public void textSearchInGroup(string text)
{
cc= this.gridControl1.CurrentCell;
if (cc.RowIndex == -1 || cc.ColIndex == -1)
this.gridControl1.CurrentCell.Activate(1, 1);
else
{
this.gridControl1.CurrentCell.Activate(cc.RowIndex, cc.ColIndex);
}
GridFindReplaceDialogSink frDialog = new GridFindReplaceDialogSink(this.gridControl1);
GridFindTextOptions option1 = GridFindTextOptions.WholeTable | GridFindTextOptions.MatchCase;
GridFindReplaceEventArgs frEventArgs = new GridFindReplaceEventArgs(text, "", option1, frLocationInfo);
GridRangeInfo frLocation = frDialog.Find(frEventArgs) as GridRangeInfo;
cc=this.gridControl1.CurrentCell;
this.gridControl1[cc.RowIndex, cc.ColIndex].BackColor = Color.Yellow;
}


Please refer the attached sample for more details.
http://websamples.syncfusion.com/samples/Grid.Windows/F72409/main.htm

Please let me know if this helps.

Regards,
Srirajan



HA Harry March 19, 2008 06:57 AM UTC

Hi Srirajan,

I use GridGroupingControl with VB.net 2005.
String s_text=String.Format("{0:#,####}", t) -> didn't change 3000 to 3,000

the problem is that there can be part number field with plain format as 3000, 1000, etc. If I implement the sample code it won't find it.
The part number is string, and price is double. So how to make the it work for all?

Another problem is: if we click Find_All with option of WholeTable, it didn't work out (The background color didn't change).

Thanks & Regards,
Harry


Loader.
Live Chat Icon For mobile
Up arrow icon