DB
David Bosak
January 20, 2005 05:08 AM UTC
I tried the following codes, it only move the cursor from start to end, not select all of text:
GridCurrentCell cc = this.dgrLookup.CurrentCell;
cc.BeginEdit();
GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl;
if(tb != null)
{
tb.SelectionStart = 0;
tb.SelectionLength = tb.Text.Length;
}
AD
Administrator
Syncfusion Team
January 20, 2005 05:26 AM UTC
Instead of
tb.SelectionStart = 0;
tb.SelectionLength = tb.Text.Length;
try
tb.SelectAll();
DB
David Bosak
January 20, 2005 07:22 AM UTC
The same as the result above.
private void dgrLookup_CellClick(object sender, Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs e)
{
GridCurrentCell cc = this.dgrLookup.CurrentCell;
cc.BeginEdit();
GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl;
if(tb != null)
{
//dgrLookup.Focus();
//tb.SelectionStart = 0;
//tb.SelectionLength = tb.Text.Length;
tb.SelectAll();
}
}
AD
Administrator
Syncfusion Team
January 20, 2005 12:34 PM UTC
There is a property that you can set so that all the text is selected anytime the cell becomes current.
this.gridDataBoundGrid1.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;
But this will select all whether you click the cell or move with the cursor keys. To only do it whne you click, use your code above, but also add e.Cancel = true. Without this, the grid continues to process the click which will do whatever the ActivateCurrentCellBehavior indicates.