Solved

No resize of the column width of the Data grid

Posted on 2004-04-01
8
509 Views
Last Modified: 2008-03-17
I set the width of the columns of the datagrid.
I don't want during runtime user should change
it. How should I prevent from doing this


Thanks
0
Comment
Question by:jra2002
  • 5
  • 2
8 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 50 total points
ID: 10732326
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
 

0
 

Author Comment

by:jra2002
ID: 10732401
In the Windows form
the name of the form is frmDisplayInformation

In that I have the datagrid name dgIccp

Public Class frmDisplayInformation
    Inherits System.Windows.Forms.Form

..
....
.....
Public Class dgIccp
 
      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


End Class

Could u please let me know what I need to do
0
 

Author Comment

by:jra2002
ID: 10732433
Dear iboutchkine
I am doing as above as u mentioned but still not working
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 10732492
add this procedure to your class


    Protected Overrides Sub onMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
        Dim hti As DataGrid.HitTestInfo = dgIccp.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
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 4

Expert Comment

by:Moizsaif123
ID: 10732507
if you are using a datagrid control from a WebForm app. in .NET then i dont think a user can resize the coloumns width or height...to set the colomns width and height attributes


<asp:BoundColumn DataField="Drug" HeaderText="Medication">
            <ItemStyle HorizontalAlign="Center" Width="444px"  VerticalAlign="Middle"></ItemStyle>
</asp:BoundColumn>
0
 

Author Comment

by:jra2002
ID: 10732516
Which class form class?
0
 

Author Comment

by:jra2002
ID: 10732536
I had added to the form class still I am able to resize column width of the grid
0
 

Author Comment

by:jra2002
ID: 10732564
Dear Moizsaif123
I am using Windows Form
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now