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.
Unfortunately, activation email could not send to your email. Please try again.

Find Replace with custom cell format

Thread ID:

Created:

Updated:

Platform:

Replies:

72409 Mar 18,2008 03:18 AM Mar 19,2008 02:57 AM Windows Forms 2
loading
Tags: GridControl
Harry
Asked On March 18, 2008 03:18 AM

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


Administrator [Syncfusion]
Replied On March 18, 2008 08:47 PM

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


Harry
Replied On March 19, 2008 02:57 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;