Autoresizeing a datagridview

Welcome Forums General PowerShell Q&A Autoresizeing a datagridview

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #5530

    Points: 0
    Rank: Member

    by Mowgli at 2013-02-09 11:51:04

    Hello there

    My first post, and working on my first script ever in Powershell...

    I am working on a simple script that will read a cvs file, parse it and ping a host (from the cvs)
    Everything works, i can ping the host, populate the datagridview, and give a row a specific color depending on the host status.
    My only problem is that I can't get the columns to autoresize, so that so that it will fit (Then content in the first cell on a row can vary in length)

    he picture below, is not the way i want it – check first cell in first row.

    This is how I would like it to look like

    How do i do that ?

    Btw. just noticed a gray "bar" at the bottom of the screenshots, how do I remove them in the form/datagridview.

    Looking forward to some help, as this is driving me crazy....


    by DonJ at 2013-02-10 07:42:19

    Someone else may jump in with an actual answer, but you're technically not asking a PowerShell question – you're digging "underneath" and simply using PowerShell to access the .NET Framework. Windows Forms, specifically, I imagine. We don't have a ton of .NET expertise running around here... so if you don't get an answer you can use, I'd suggest asking at, where the "real" developers hang out – guys and gals who probably know the answer off the top of their head.

    In fact, I did a little search over there and someone may have already asked this question – – it may be in C# or VB, but should be translatable to what you're doing in PowerShell pretty easily. Alternately, hit up the guys at in their forums. Their PowerShell Studio product is designed to do Windows Forms with PowerShell, and they may well have a good answer for you, too.

    by Mowgli at 2013-02-15 11:53:03

    Thanks a lot m8, i will go have a look at Sapien or at Stackoverflow

The topic ‘Autoresizeing a datagridview’ is closed to new replies.