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

Changing currency symbol in grid

Hello, I''m trying to change the currency symbol in a grid control, so I''m using the CurrencyEdit.CurrencySymbol property of the particular cell. This used to work fine, until I used version 2.0.3.0 RC1. Am I doing something wrong? Thanks. Raymond.

8 Replies

AD Administrator Syncfusion Team March 18, 2004 09:05 PM UTC

This is broken. We will get it fixed for the release.


RS Raymond S Gunawan March 23, 2004 07:37 PM UTC

Any estimate on when this will get fixed? We need to get a demo out with this functionality soon. Is there a workaround this that I can use for now? Thanks a bunch! Raymond >This is broken. We will get it fixed for the release.


AD Administrator Syncfusion Team March 23, 2004 08:20 PM UTC

You can handle the CurrentCellControlGotFocus event. In the handler, get the style for the cell and transfer any style.CurrencyEdit properties that you are using to the cell control.
private void gridControl1_CurrentCellControlGotFocus(object sender, System.Windows.Forms.ControlEventArgs e)
{
	GridCurrencyTextBox tb = e.Control as GridCurrencyTextBox;
	if(tb != null)
	{
		GridCurrentCell cc = this.gridControl1.CurrentCell;
		GridStyleInfo style = this.gridControl1[cc.RowIndex, cc.ColIndex];
		tb.CurrencySymbol = style.CurrencyEdit.CurrencySymbol;
		//set whatever other style.CurrencyEdit properties you need
	}
}


RS Raymond S Gunawan March 23, 2004 08:55 PM UTC

Thanks a lot! That works well. However, when I start typing without clicking on the cell first, right after the first number typed, the cursor is reset to the beginning of the line. Hence, if I type in "12", "21" will be shown. Could you tell me how to fix this? Thanks Raymond. >You can handle the CurrentCellControlGotFocus event. In the handler, get the style for the cell and transfer any style.CurrencyEdit properties that you are using to the cell control. > >
>private void gridControl1_CurrentCellControlGotFocus(object sender, System.Windows.Forms.ControlEventArgs e)
>{
>	GridCurrencyTextBox tb = e.Control as GridCurrencyTextBox;
>	if(tb != null)
>	{
>		GridCurrentCell cc = this.gridControl1.CurrentCell;
>		GridStyleInfo style = this.gridControl1[cc.RowIndex, cc.ColIndex];
>		tb.CurrencySymbol = style.CurrencyEdit.CurrencySymbol;
>		//set whatever other style.CurrencyEdit properties you need
>	}
>}
>


AD Administrator Syncfusion Team March 23, 2004 09:24 PM UTC

You can avoid it by making the cell start editing when it becomes the current cell. You can do this grid wide by setting this property. this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SetCurrent; But if you only want to do it for currencycells, you can handle the CurrentCellMoved event, and start the cell editing there if it is a currency cell.
private void grid_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(!cc.IsEditing && this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "Currency")
	{
		cc.BeginEdit(true);
	}
}


RS Raymond S Gunawan March 23, 2004 10:22 PM UTC

I wanted the cell to act like an Excel cell, so that it doesn''t get activated until I hit a number. Is there a way to do this? Thanks a lot for your help. It''s been really helpful Raymond. >You can avoid it by making the cell start editing when it becomes the current cell. You can do this grid wide by setting this property.


AD Administrator Syncfusion Team March 23, 2004 11:15 PM UTC

I think you will have to wait until we fix the original problem.


RS Raymond S Gunawan March 24, 2004 01:31 PM UTC

Okay then. Thanks a lot for your help! Raymond. >I think you will have to wait until we fix the original problem.

Loader.
Live Chat Icon For mobile
Up arrow icon