Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
515
Cell SelectAll
posted

On form load i want a select all text in a particular cell value.

Here is my code, and cell is editable by user

 

ugPayments.ActiveCell = ugPayments.Rows(i).Cells(4)

ugPayments.ActiveCell.Selected =

True

ugPayments.ActiveCell.SelectAll()

But it is throwing me an error saying

Operation cannot be performed when not in edit mode.

Parents Reply Children
  • 725
    Offline posted in reply to Matt Snyder

    Hi, I know this is old, but wanted to share what worked for me

    '->without e.Handled = True, SelectAll does not seem to work

     

     

        Private Sub UltraGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid1.KeyDown

            Try                                                                              

     

                If e.KeyCode = Keys.Down Then

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, False, False)

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.BelowCell, False, False)

                    e.Handled = True '->sin esta instrucción, no se selecciona el contenido de la celda

                    If UltraGrid1.ActiveRow.Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit Then

                        UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, False, False)

                        If UltraGrid1.ActiveCell.IsInEditMode Then UltraGrid1.ActiveCell.SelectAll()

                    End If

                ElseIf e.KeyCode = Keys.Up Then

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, False, False)

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.AboveCell, False, False)

                    e.Handled = True '->sin esta instrucción, no se selecciona el contenido de la celda

                    If UltraGrid1.ActiveRow.Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit Then

                        UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, False, False)

                        If UltraGrid1.ActiveCell.IsInEditMode Then UltraGrid1.ActiveCell.SelectAll()

                    End If

                ElseIf e.KeyCode = Keys.Left Then

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, False, False)

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.PrevCell, False, False)

                    e.Handled = True '->sin esta instrucción, no se selecciona el contenido de la celda

                    If UltraGrid1.ActiveRow.Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit Then

                        UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, False, False)

                        If UltraGrid1.ActiveCell.IsInEditMode Then UltraGrid1.ActiveCell.SelectAll()

                    End If

                ElseIf e.KeyCode = Keys.Right Then

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, False, False)

                    UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextCell, False, False)

                    e.Handled = True '->sin esta instrucción, no se selecciona el contenido de la celda

                    If UltraGrid1.ActiveRow.Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit Then

                        UltraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, False, False)

                        If UltraGrid1.ActiveCell.IsInEditMode Then UltraGrid1.ActiveCell.SelectAll()

                    End If

                End If

     

     

     

     

            Catch ex As Exception

                MsgBox(ex.Message & " " & Me.Name & " -UltraGrid1_KeyDown(")

            End Try

        End Sub

    'mariela pez