January 1, 2012 at 12:00 am #5530MemberPoints: 0Rank: Member
by Mowgli at 2013-02-09 11:51:04
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)
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 StackOverflow.com, 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 – http://stackoverflow.com/search?q=auto+resize+datagrid – 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 SAPIEN.com 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.