We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Preventing from Resizing Datagrid Columns

Thread ID:





361 Jun 11,2002 10:12 PM UTC Jun 12,2002 04:10 AM UTC WinForms 1
Tags: FAQ
Administrator [Syncfusion]
Asked On June 11, 2002 10:12 PM UTC

You have suggested this solution in the Windows Forms FAQ. However, it is not working for me or shall I say that I don't really know how to implement it in my code. I just added a new Class in my project and added the code below. Nothing happens. Should I be calling the class from somewhere? Public Class MyDataGrid Inherits DataGrid Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs) Dim hti As DataGrid.HitTestInfo = Me.HitTest(New Point(e.X,e.Y)) If hti.Type = DataGrid.HitTestType.ColumnResize Then Return 'no baseclass call End If MyBase.OnMouseMove(e) End Sub End Class

Clay Burch [Syncfusion]
Replied On June 12, 2002 04:10 AM UTC

If you have dropped a datagrid onto your form with the designer, then this datagrid is defined as Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid and created with this code Me.DataGrid1 = New System.Windows.Forms.DataGrid() So, the grid being displayed is NOT your MyDataGrid class, but the Systems.Windows.Forms.DataGrid. What you have to do is to make your code use your class. One way to do this is to just change the two statements (even though there are dire warnings about doing so as this code is part of the designer created code). Friend WithEvents DataGrid1 As MyDataGrid and Me.DataGrid1 = New MyDataGrid()


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon