DataGridView - when I search multiple times, the first cell data is blank
Posted: Thu May 02, 2019 12:44 pm
To help you better we need some information from you.
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: PowerShell Studio 2019 version 5.6.162
32 or 64 bit version of product: 64
Operating system: Windows 10
32 or 64 bit OS: 64
*** Please add details and screenshots as needed below. ***
I got PS Studio for my job a couple of weeks ago and I LOVE IT! It is wonderful. It was a very easy transition moving from C# WinForms to PS WinForms.
I'm running into my first snag though today.
I have a few forms in my multi-form program that I am using DataGridViews for. Most of them are 1 column wide, so I am just manually adding to that DGV from a foreach-object loop to populate it.
However, I'm working on one that is multi-column to show user names and access types for e-mail permissions (Connects to Exchange, tells you who has what kind of access to that mailbox).
For instance,
You would search for mailbox1@abc.com
It would return
Name|AccessType
John | FullAccess
Mary | FullAccess
That's all good and fine. HOWEVER... If I type a different e-mail address and click search again, this is what happens:
Name|AccessType
| FullAccess
Jack | FullAccess
It is erasing the first cell for some reason on that reload/new search.
Here is the code I currently have:
Does anyone know how to fix that issue?
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: PowerShell Studio 2019 version 5.6.162
32 or 64 bit version of product: 64
Operating system: Windows 10
32 or 64 bit OS: 64
*** Please add details and screenshots as needed below. ***
I got PS Studio for my job a couple of weeks ago and I LOVE IT! It is wonderful. It was a very easy transition moving from C# WinForms to PS WinForms.
I'm running into my first snag though today.
I have a few forms in my multi-form program that I am using DataGridViews for. Most of them are 1 column wide, so I am just manually adding to that DGV from a foreach-object loop to populate it.
However, I'm working on one that is multi-column to show user names and access types for e-mail permissions (Connects to Exchange, tells you who has what kind of access to that mailbox).
For instance,
You would search for mailbox1@abc.com
It would return
Name|AccessType
John | FullAccess
Mary | FullAccess
That's all good and fine. HOWEVER... If I type a different e-mail address and click search again, this is what happens:
Name|AccessType
| FullAccess
Jack | FullAccess
It is erasing the first cell for some reason on that reload/new search.
Here is the code I currently have:
- $currentMailbox = $emailAddress.Text
- $getRights = get-mailbox $currentMailbox | get-mailboxpermission | ? { ($_.User -ne 'NT AUTHORITY\SELF') -and ($_.IsInherited -eq $false) } | select @{ Name = "User Name"; expression = { (Get-Recipient $_.user.tostring()).displayname } }, accessrights
- Update-DataGridView -DataGridView $datagridviewResults -Item $getRights #-AutoSizeColumns DisplayedCells