Solved

No resize of the column width of the Data grid

Posted on 2004-04-01
8
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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