Datagrid Column header size extending to anchored position?

Posted on 2006-04-18
Last Modified: 2010-05-18

I have a datagrid that is populated with data. I have the grid anchored to the right. When I open the form in my application I can re-size the window and the datagrid expands to the right. The buttons of the datagrid (add, remove, etc) all resize to fit as well.

The problem is, the last column does not stretch to fit the datagrid. It's a text field called "Summary". This column has a set width of 120 as defined by the table style for the datagrid. Despite the datagrid resizing, it does not stretch the end of this column when you resize the window.

Does anyone know how I can accomplish this?
Question by:dmct3
    1 Comment
    LVL 96

    Accepted Solution

    You can use a table style, and define column widths based on a percentage of grid width, instead of fixed pixels.

    style.ColumnWidth = Me.DataGrid1.Width * .3


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now