Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell datagridview datasource or not - what is the best practice

$
0
0

I need a simple datagridview containing a checkbox column and 2 string columns.  The checkbox column gets set by a user, but the other 2 can be set programmatically based on conditions in the network.  

My first approach was to make the network updates directly in the dgv.  When I debug the code, I can see that the dgv has the correct network info, but the screen was never updating/refreshing.  I tried many variations of refresh/beginEdit/endEdit/InvalidateCell etc and had no luck.

Then I decided to create a datasource for the dgv and update the datasource.  I SUCCESSFLLY created and populated an ArrayList with 3 rows of test data.  I then bound the Arraylist to the dgv: $dgv.DataSource = $arrList and then I did form1.refresh.  The dgv now shows 3 rows (with no data), and several additional columns (Length, LongLength, Rank, SyncRoot, IsReadOnly, IsFixedSize, IsSynchronized) that I did not add.  These columns look like dgv attributes.

First of all which is the best approach, create an ArrayList and use it as a datasource for my dgv or just update the dgv directly.

How do I refresh this thing?  

How do I get rid of the extra columns from the datasource?

I appreciate any insight.  


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>