Results 1 to 2 of 2

Thread: resize a datagrid

  1. #1
    Guest

    Post

    How do you resize the columns datagrid when you maximize your screen?

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Try this.
    Code:
    Option Explicit
    
    Public m_dCol0Factor As Double
    Public m_dCol1Factor As Double
    Public m_dGridFactor As Double
    
    Private Sub Form_Load()
    
    m_dCol0Factor = DataGrid1.Columns(0).Width / Form1.Width
    m_dCol1Factor = DataGrid1.Columns(1).Width / Form1.Width
    m_dGridFactor = DataGrid1.Width / Form1.Width
    
    
    End Sub
    
    
    Private Sub Form_Resize()
    
        DataGrid1.Columns(0).Width = Form1.Width * m_dCol0Factor
        DataGrid1.Columns(1).Width = Form1.Width * m_dCol1Factor
        DataGrid1.Width = Form1.Width * m_dGridFactor
        
    End Sub
    ------------------
    Marty
    COGITO EGGO SUM
    I think; therefore I am a waffle.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width