Can you tell me what I'm doing wrong ?
Why does the cell not enter edit mode with this ... the correct line is selected and everything,but I have to use the mouse to click the cell to enter it's edit mode-> I want the cell in edit-mode right away ...
This is my code:
_ugFinishDateChanges.DataSource = changes;
if (changes.Count > 0){ _ugFinishDateChanges.Selected.Rows.Clear(); _ugFinishDateChanges.Selected.Rows.Add(_ugFinishDateChanges.Rows[0]); _ugFinishDateChanges.Focus(); _ugFinishDateChanges.ActiveRow = _ugFinishDateChanges.Rows[0]; _ugFinishDateChanges.PerformAction(UltraGridAction.EnterEditMode); _ugFinishDateChanges.ActiveCell = _ugFinishDateChanges.Rows[0].Cells[
_ugFinishDateChanges.ActiveCell = _ugFinishDateChanges.Rows[0].Cells[
"ReasonForChange"];
//why does the actual "ReasonForChange" CELL not get the focus ??
}
The code you have here is setting the ActiveCell, but that doesn't put the cell into edit mode. Active and in edit mode are two totally different things.
What you need to do is, after you set the ActiveCell, call the PerformAction method on the grid and tell it to EnterEditMode.
Hi Mike!
I've already tried that, by switching the lines like this ... but it still won't enter EDIT-MODE( the cell is correcty selected and everything but I have to CLICK IT so I can actually write any text inside the cell )
This is my code - it's NOT working:
if
(changes.Count > 0) { _ugFinishDateChanges.Selected.Rows.Clear(); _ugFinishDateChanges.Selected.Rows.Add(_ugFinishDateChanges.Rows[0]); _ugFinishDateChanges.Focus(); _ugFinishDateChanges.ActiveRow = _ugFinishDateChanges.Rows[0]; _ugFinishDateChanges.ActiveCell = _ugFinishDateChanges.Rows[0].Cells[
{
_ugFinishDateChanges.Selected.Rows.Clear();
_ugFinishDateChanges.Selected.Rows.Add(_ugFinishDateChanges.Rows[0]);
_ugFinishDateChanges.Focus();
_ugFinishDateChanges.ActiveRow = _ugFinishDateChanges.Rows[0];
]; _ugFinishDateChanges.PerformAction(
_ugFinishDateChanges.PerformAction(
.EnterEditMode);
//hvernig set g fkusinn "ReasonForChange" celluna ????
I should note that I tried debugging the Grid after the code has been run,and I see that this value is FALSE:_ugFinishDateChanges.ActiveCell.IsInEditMode
Although this code IS run:_ugFinishDateChanges.PerformAction(UltraGridAction.EnterEditMode);
I also tried setting this below:
UltraGridAction.EnterEditMode);
_ugFinishDateChanges.ActiveCell.SelectAll();and this latter row gives me what I've would have thought, when NOT in edit-mode:"Can't access SelectionStart unless the Editor is in edit mode" So why is it still not in EDIT mode ?? rgd,EE.
_ugFinishDateChanges.ActiveCell.SelectAll();and this latter row gives me what I've would have thought, when NOT in edit-mode:"Can't access SelectionStart unless the Editor is in edit mode"
So why is it still not in EDIT mode ??
rgd,EE.
What event is this code in? You can't do this in Form_Load because DotNet will not allow you to set focus to a control before the form is displayed.