Search Amazon:

Make a .NET Winforms DataGrid have no current cell

You can do this by subclassing your DataGrid and adding the following code:

    Public Class DataGridEx  	
        Inherits DataGrid  	
	
        Public WM_LBUTTONDOWN As Integer = 513  	
        Public WM_LBUTTONUP As Integer = 514  	
	
        Shared Function SendMessage(hWnd As IntPtr, msg As Int32, _
            wParam As Int32, lParam As Int32) As Boolean  	

        Public Sub NoCurrentCell()  	
            '
            ' Simulate a click on top left corner of the grid.
            '
            SendMessage(Me.Handle, WM_LBUTTONDOWN, 0, 0)  	
            SendMessage(Me.Handle, WM_LBUTTONUP, 0, 0)  	
        End Sub
    End Class	
Sign In
  User Id 
  Password 


Submit Your Own Code and Articles




About TheScarms
About TheScarms

Ask me your programming questions

I read every email and answer all I can.

User Feedback: Be the first to add a comment! Items to Show:     

     
You must log in to post feedback.
Comment:    
 

If you use this code, please mention "www.TheScarms.com"

Email this page


TheScarms AppSentinel lets you securely copy protect and create evaluation versions of your software

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Get your free
trial copy today!


      The World's Number 1 Web Host

© Copyright 2008 TheScarms