Skip to content

Replies

0
khalid
khalid answered on Oct 28, 2009 8:27 PM

aftercellupdate didnt work, had to use the BeginInvoke to call the Method.

Thanks

0
khalid
khalid answered on Oct 27, 2009 5:14 PM

the function is being called from AfterExitMode of the grid, the function is used to check if any duplicat item is found in the column, if its found then it should select that cell and EnterEditMode.

0
khalid
khalid answered on Oct 26, 2009 5:57 PM

tried it , didnt work.

after i hit ok on the message box, the keyboard cursor goes on the next column of the last row.

here's my code

    Private Function CheckItemInGrid(ByVal Item As String) As Boolean
        Dim CheckValue As String

        For i As Integer = 0 To (grdInvoice.Rows.Count) – 2
            CheckValue = grdInvoice.Rows(i).Cells(0).Value.ToString

            If CheckValue = Item Then
                grdInvoice.Rows(i).Cells(0).Selected = True
                MsgBox("Item Already Exists")

                'grdInvoice.ActiveRow.Delete(False)
                grdInvoice.ActiveRow = grdInvoice.Rows(i)
                grdInvoice.ActiveCell = grdInvoice.ActiveRow.Cells(0)
                'grdInvoice.PerformAction(EnterEditMode, False, False)

                Return True

                Exit For
                Exit Function
            End If
        Next

        Return False
    End Function

 

0
khalid
khalid answered on Sep 18, 2009 4:22 PM

i have moved the msgbox right before the exit for.

I can see the activerow selected but after i press ok on the msgbox, it goes back to the next cell of the last row.

0
khalid
khalid answered on Sep 17, 2009 2:58 AM

I am trying to find the row, its works, but i am unable to select the row or make it active, it moves to the next cell

here is the sample code

Dim CheckValue As String
For i As Integer = 0 To
(grdInvoice.Rows.Count) – 2
CheckValue = grdInvoice.Rows(i).Cells(0).Value.ToString

If CheckValue = Item Then
grdInvoice.Rows(i).Cells(0).Selected = True
MsgBox("Item Already Exists") 

 

 

grdInvoice.ActiveCell = grdInvoice.Rows(i).Cells(0)
grdInvoice.PerformAction(EnterEditMode,
False, False)
grdInvoice.Focus()

 

End If
Next