ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.FirstCellInGrid).
ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.entereditmode).
When are you doing this? In what event?
in the Constructor method of the class. basically, i am starting out with an empty grid and want the user to populate it using the 'AddRowOnTop'. i want focus to be in the first field so they can just start typing without having to mouse click. i have been trying to figure out how to programmatically set ActiveRow = the AddRow with no luck. thanks for getting back to me on this.
Hello all,
I have a very similar problem but even using the suggestions above I cant get it to work.
Heres my code under a button. Grid is already displayed on the form and form is loaded.
Try With uwGrid_CN_St1_QuoteItems .DisplayLayout.Bands(0).AddNew() .Selected.Rows.Clear() .Rows(.Rows.Count - 1).Selected = True .ActiveRow = .Selected.Rows(0) uwGrid_CN_St1_QuoteItems = objTools.uwgInitRowSelectedPointer(uwGrid_CN_St1_QuoteItems, strWhoAmI) With .DisplayLayout.ActiveRow .Cells("ID").Value = "0" .Cells("InvID").Value = "0" .Cells("Item Description").Value = "Items description to go Here!" .Cells("Karat").Value = "0" .Cells("Weight(DWT)").Value = "0" .Cells("Buying Price").Value = "0" End With End With vBtn_CN_St1_RemoveItem.Enabled = True vBtn_CN_St1_CreateQuote.Enabled = True Catch ex As Exception objTools.RecordErrorMsg(ex.Message, My.Application.Info.Title, My.Application.Info.Version.ToString, strWhoAmI, strWhoCalledMe, "", "", msUserID, msStoreIdToUse) End Try
I would like focus to be on the .Cells("Item Description"). cell with "Items description to go Here!"selected.
I have tried .Cells("Item Description").SelectAll() deirectly after the line: .Cells("Item Description").Value = "Items description to go Here!"
But no good. Also tried in the After Row insert event but that didn't help either.
Any ideas would be welcome. This seems like it should be a easy thing to do.
Thanks
Deasun
Hi Deasun,
You are mixing up selected and active. You can get rid of these two lines of code:
.Selected.Rows.Clear().Rows(.Rows.Count - 1).Selected = True
They will do nothing. Selection will get cleared once you add a new row, anyway, and you can't have selected rows while a cell is in edit mode.
You also don't need to set the ActiveRow. The AddNew call will do that for you automatically. So you can get rid of this line:
.ActiveRow = .Selected.Rows(0)
Now... to answer your question, what you need to do is set the ActiveCell to the appropriate cell and then use the PerformAction method to EnterEditMode:
.ActiveRow = .Cells("Item Description") .PerformAction(EnterEditMode, False, False)
.ActiveRow = .Cells("Item Description")
.PerformAction(EnterEditMode, False, False)
If ActiveCell is null, then the grid cannot be in edit mode.
Thanks very much.
Worked like a charm after a little change.
Code now is:
.ActiveCell = .DisplayLayout.ActiveRow.Cells("Item Description").PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, False, False)
Thanks again for the pointers.