How can I make the datagrid have no currentcell?

loyal

Centurion
Joined
Jul 29, 2003
Messages
102
Hi I found the solution but it seems does not work !

I found that the Shared function without End Function TAG
and it was a design time error
then I fixed it

well should I call the SetNoCurrentCell() from specific Event or just
on Load Form Event

can someone rewrite the code again with few notes & Comments

here's the code
Code:
Public Class MyDataGrid

    Inherits DataGrid

    Public WM_LBUTTONDOWN As Integer = 513

    Public WM_LBUTTONUP As Integer = 514



 Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Int32,
 ByVal wParam As Int32, ByVal lParam As Int32) As Boolean


    End Function

    Public Sub SetNoCurrentCell()

        'click on top left corner of the grid 

        SendMessage(Me.Handle, WM_LBUTTONDOWN, 0, 0)

        SendMessage(Me.Handle, WM_LBUTTONUP, 0, 0)

    End Sub 'SetNoCurrentCell 

End Class 'MyDataGrid

Help will be approciated
 
Try this....

I had the same problem with the same example code. This works better!

Visual Basic:
    Private Sub myDataGrid_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles myDataGrid.CurrentCellChanged

        'Lose focus
        myDataGrid.Controls.Clear()

        'Select the whole ROW
        myDataGrid.Select(myDataGrid.CurrentCell.RowNumber)

    End Sub
 
Hhmmm.... Maybe it needs some tweaking cause it will screw up the scrollbars.

If anyone can solve this please let us know.
 
Back
Top