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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Select all data in cell regardless of cell type

Thread ID:

Created:

Updated:

Platform:

Replies:

15909 Jun 30,2004 12:03 PM UTC Jul 1,2004 10:19 AM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 30, 2004 12:03 PM UTC

Is there a way in the code that you can select all the data in a cell regardless of the cell type? For instance if i want to click a button that will highlight the whole cell and have it look as it would if I used your selectall activate event? Can this be done or do you have to first figure out the cell type and then do each one individually?

Administrator [Syncfusion]
Replied On June 30, 2004 02:13 PM UTC

If you are willing to live with the ActivateCurrentCellBehavior.SelectAll setting, then just moving the current cell and then setting the focus back to the grid seems to work. But if you do not want this setting, then I think you would have to handle it celltype by celltype.
private void button1_Click(object sender, System.EventArgs e)
{
	this.grid.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;
			this.grid.CurrentCell.MoveTo(2,3);
			this.grid.Focus();
}

Administrator [Syncfusion]
Replied On June 30, 2004 03:08 PM UTC

That works but it always makes my activate property to selectall then. Is there any other way to do it where it wont change whatever that property may be? On a text box I have been just dimming a variable as a textbox and then setting it equal to the renderer control text and then do a select all of the text box. I can get this to work on some cell types but like on a currency cell type I cant.

Administrator [Syncfusion]
Replied On June 30, 2004 04:44 PM UTC

It is not too elegant, but it does work for a currencycell.
TextBox tb;
Timer timer1 = new System.Windows.Forms.Timer();


//in formload
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

private void button1_Click(object sender, System.EventArgs e)
{
	this.grid.CurrentCell.MoveTo(2,3, GridSetCurrentCellOptions.SetFocus);
	this.grid.Focus();
	this.tb = grid.CurrentCell.Renderer.Control as TextBox;
	if(this.tb != null)
		this.timer1.Enabled = true;
}

private void timer1_Tick(object sender, System.EventArgs e)
{
	this.timer1.Enabled = false;
	tb.SelectAll();
}

Philip Bishop
Replied On July 1, 2004 10:19 AM UTC

I am doing something kind of similar to what I think you are wanting and I have it working one of two ways. I''m not for sure if one is better then the other or which one I will end up using, but both appear to work. Dim cc As Grid.GridCurrencyTextBox = CType(Me.grdArrearsS.CurrentCell.Renderer.Control, Grid.GridCurrencyTextBox) cc.SelectAll() Dim tb As TextBox = CType(Me.grdArrearsS.CurrentCell.Renderer.Control, TextBox) tb.SelectAll()

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.

Warning Icon 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.Close Icon

;