Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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



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

Gary Says: To be a good programmer, you must be good at debugging
  • 6 months later...
Posted

Try this....

 

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

 

   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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...