Search found 11 matches

by iamtj69
Fri Feb 14, 2020 7:04 am
Forum: PowerShell GUIs
Topic: DataGridView - Column Text Alignment Issue
Replies: 8
Views: 1067

Re: DataGridView - Column Text Alignment Issue

Sorry, maybe i wasn't being very clear. I was just trying to disable the ability for a user to sort any column in the datagridview (i have achieved this now), i wasn't trying to "unsort" any columns. The data comes pre-sorted from an SQL database as a dataset (collection of datatables). I then popul...
by iamtj69
Fri Feb 14, 2020 5:36 am
Forum: PowerShell GUIs
Topic: DataGridView - Column Text Alignment Issue
Replies: 8
Views: 1067

Re: DataGridView - Column Text Alignment Issue

How do you recommend i disable the ability to sort on all columns?

I am trying following with no joy:

Code: Select all

foreach ($col in $datagridview1.Columns)
{
	$col.SortMode = 'NotSortable'
}
by iamtj69
Fri Feb 14, 2020 5:22 am
Forum: PowerShell GUIs
Topic: DataGridView - Column Text Alignment Issue
Replies: 8
Views: 1067

Re: DataGridView - Column Text Alignment Issue

Ah, ok that makes sense.

Does something similar apply for disabling "sort". This is something else i have been struggling with. How can i disable 'sort' for an entire grid?
by iamtj69
Fri Feb 14, 2020 2:50 am
Forum: PowerShell GUIs
Topic: DataGridView - Column Text Alignment Issue
Replies: 8
Views: 1067

DataGridView - Column Text Alignment Issue

Hello, I am trying to "Middle Right" align text in a column in a DataGridView. I am trying the following: $datagridview1.Columns["total"].DefaultCellStyle.Alignment = 'MiddleRight' $datagridview1.Columns["total"].HeaderCell.Style.Alignment = 'MiddleRight' However i am receiving the following: ERROR:...
by iamtj69
Mon Apr 30, 2018 7:36 am
Forum: PowerShell GUIs
Topic: Setting datatable columns to allow null values (AllowDBNull)
Replies: 10
Views: 3641

Re: Setting datatable columns to allow null values (AllowDBNull)

The old ConvertTo-DataTable may have some issues. You need to use the newer version. Thanks jvierra, I will update to the latest version ASAP. This is an interesting one, and like you say, may be resolved in the latest version but in case any one else is interested... I shall describe what I found:...
by iamtj69
Mon Apr 30, 2018 1:52 am
Forum: PowerShell GUIs
Topic: Setting datatable columns to allow null values (AllowDBNull)
Replies: 10
Views: 3641

Re: Setting datatable columns to allow null values (AllowDBNull)

Hello jvierra,

I am using the following version:

PowerShell Studio 2017 v5.4.143
by iamtj69
Fri Apr 27, 2018 4:05 am
Forum: PowerShell GUIs
Topic: Setting datatable columns to allow null values (AllowDBNull)
Replies: 10
Views: 3641

Re: Setting datatable columns to allow null values (AllowDBNull)

Thanks for the tip jvierra, i have adjusted as instructed. I am still having issues working out how to set the columns in the datatable to allow null values. Any ideas on where and how to adjust the 'ConvertTo-DataTable' function to set the columns to AllowDBNull as the columns are created? Many tha...
by iamtj69
Fri Apr 27, 2018 1:26 am
Forum: PowerShell GUIs
Topic: Setting datatable columns to allow null values (AllowDBNull)
Replies: 10
Views: 3641

Re: Setting datatable columns to allow null values (AllowDBNull)

#region Control Helper Functions function Update-DataGridView { <# .SYNOPSIS This functions helps you load items into a DataGridView. .DESCRIPTION Use this function to dynamically load items into the DataGridView control. .PARAMETER DataGridView The DataGridView control you want to add items to. .P...
by iamtj69
Thu Apr 26, 2018 9:50 am
Forum: PowerShell GUIs
Topic: Setting datatable columns to allow null values (AllowDBNull)
Replies: 10
Views: 3641

Setting datatable columns to allow null values (AllowDBNull)

Hello, I am hoping somebody can help me. I have a datagridview control on a form which is populated with data from a datatable using the 'ConvertTo-DataTable' and then 'Update-DataGridView' functions. The above works ok accept for one issue: One of the columns contains null values and throws a bunch...
by iamtj69
Mon Oct 16, 2017 9:04 am
Forum: PowerShell GUIs
Topic: Query a form controls BackColor?
Replies: 3
Views: 973

Re: Query a form controls BackColor?

Perfect! Thank you.