DataGridView commit change immediately

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
noescape
Posts: 16
Last visit: Tue Jan 04, 2022 2:17 am

DataGridView commit change immediately

Post by noescape »

Product, version and build: PowerShell Studio 2015 Version 4.2.83
32 or 64 bit version of product: 64bit
Operating system: Win8.1 64bit

Hi,

I'm interested in the option of commiting changes to any cell inside a DataGridView without ending the edit mode.
I've found some options for C# and other languages but I was unable to make it work in PS Studio.

Thanks for help,

Thomas
User avatar
noescape
Posts: 16
Last visit: Tue Jan 04, 2022 2:17 am

Re: DataGridView commit change immediately

Post by noescape »

Nevermind,

the solution is:
  1. $DGV_CurrentCellDirtyStateChanged={
  2.     if ($DGV.IsCurrentCellDirty)
  3.     {
  4.         $DGV.CommitEdit([System.Windows.Forms.DataGridViewDataErrorContexts]::Commit)
  5.     }
  6.    
  7. }
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: DataGridView commit change immediately

Post by DevinL »

[POST MOVED TO THE POWERSHELL GUI FORUM BY MODERATOR]

Glad to know you figured it out.

I moved this post to the PowerShell GUI forums in case anyone else would like this for future reference.
DevinL
SAPIEN Technologies, Inc.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked