Search found 11132 matches

by jvierra
Wed Aug 16, 2017 3:16 pm
Forum: PowerShell GUIs
Topic: Combo Box SelectedIndex Changes Automatically
Replies: 17
Views: 182

Re: Combo Box SelectedIndex Changes Automatically

I could have made 20 guesses before guessing t that. That also tells me that your code is changing something on the combo else the autocomplete would not do that. I suspect you will find other issues down the road. Go slow and look hard. Most things are discoverable in the debugger or with some brai...
by jvierra
Wed Aug 16, 2017 2:29 pm
Forum: PowerShell GUIs
Topic: Combo Box SelectedIndex Changes Automatically
Replies: 17
Views: 182

Re: Combo Box SelectedIndex Changes Automatically

Start by placing a breakpoint at the beginning of every event and every function. Run the form to the place where the problem happens and watch every line of code until you see where the error is happening. It may also be caused by interleaved closures. This is the hardest coding error to find. By c...
by jvierra
Wed Aug 16, 2017 2:19 pm
Forum: PowerShell GUIs
Topic: Combo Box SelectedIndex Changes Automatically
Replies: 17
Views: 182

Re: Combo Box SelectedIndex Changes Automatically

Well it's in your code. You just have to keep debugging until you find the code that causes this. It is not a usual behavior of a control. Somewhere you have a mistake or an error. Debugging code takes time to learn. We cannot do it for you since we do not have access to your system. One method for ...
by jvierra
Wed Aug 16, 2017 12:50 pm
Forum: PowerShell GUIs
Topic: Combo Box SelectedIndex Changes Automatically
Replies: 17
Views: 182

Re: Combo Box SelectedIndex Changes Automatically

Sorry. For some reason I missed that. This is a better way to handle validation: $cmb_Role_Validating = [System.ComponentModel.CancelEventHandler]{ $_.Cancel = if ($this.Text -in $($MDTRoles.Role)) { [void]$errorprovider1.SetError($this, '') $false } else { [void]$errorprovider1.SetError($this, 'Ple...
by jvierra
Wed Aug 16, 2017 11:44 am
Forum: PowerShell GUIs
Topic: Combo Box SelectedIndex Changes Automatically
Replies: 17
Views: 182

Re: Combo Box SelectedIndex Changes Automatically

I do not understand why you have this code: Validate-ComboBox What does it do and why are you not using the validating event? If you want a common validation method then just assign both boxes to the same event. This makes the code easier to maintain and understand. If you do feel that a function is...
by jvierra
Wed Aug 16, 2017 11:27 am
Forum: PowerShell GUIs
Topic: Combo Box SelectedIndex Changes Automatically
Replies: 17
Views: 182

Re: Combo Box SelectedIndex Changes Automatically

You still need to provide a clear statement of what is happening using exact control names. You keep saying an index or box changes but fail to provide a complete description. The selection on a combo box will only change if you change the contents or if you have another control that accesses the bo...
by jvierra
Wed Aug 16, 2017 10:04 am
Forum: PowerShell GUIs
Topic: Datagridview - DataGridViewImageColumn
Replies: 10
Views: 132

Re: Datagridview - DataGridViewImageColumn

Thank you. If you are really interested in techniques fro designing powerful and flexible forms solutions with PowerShell Studio then have a look at these articles: http://tech-comments.blogspot.com/2017/03/powershell-understanding-windows-forms.html There are currently four articles in the series l...
by jvierra
Wed Aug 16, 2017 9:00 am
Forum: PowerShell GUIs
Topic: Datagridview - DataGridViewImageColumn
Replies: 10
Views: 132

Re: Datagridview - DataGridViewImageColumn

Re-assigning the data source always replaces everything. Setting it to null removes all definitions including column.

If you don't assign columns and set the columns to autosize and generate then this would not matter. Either way works.
by jvierra
Wed Aug 16, 2017 8:50 am
Forum: PowerShell GUIs
Topic: Datagridview - DataGridViewImageColumn
Replies: 10
Views: 132

Re: Datagridview - DataGridViewImageColumn

If you do not set the datatsource to $null the columns will not be removed. Try it.
by jvierra
Wed Aug 16, 2017 8:37 am
Forum: PowerShell GUIs
Topic: Datagridview - DataGridViewImageColumn
Replies: 10
Views: 132

Re: Datagridview - DataGridViewImageColumn

Why do you keep reloading the data?

Start by removing this line: "$datagridview3.DataSource = $null" as it is unnecessary and will remove all formatting.