0

After publishing my program on a new server some of my datagridviews have started to hang when attempting to show an AutoCompleteStringCollection. This error occurs only after publishing my application and never in the emulator when testing.

This occurs immediately after begining edit on a cell.

This may be unrelated but recently my boss has decided to move several of the servers to virtual machines and upgrade all the computers to Windows 10. I should note that I already had windows 10 installed and did not have this problem prior.

I have tried running resource monitor and it says 'one or more threads of "ProgramName" are waiting to finish network I/O.' I also tried this on the server it is hosted and got not responding.

I have tried attaching an empty autocompletestringcollection but it still hangs.

On another note since updating on the login page of my program I have been getting an unable to find database error. This only happens the odd time but did not occur before.

Sometimes this error does not occur but this is irregular.

The error occurs even if the cell you are editing does not have an autocompletestringcollection to it.

'Items like _taxCodeAutoComplete.Codes are just autocompletestring collections 'inside an object

Public Sub SetEditingControlShowing(e As DataGridViewEditingControlShowingEventArgs, collection As AutoCompleteStringCollection)
        Dim txt As TextBox = e.Control
        With txt
            .AutoCompleteMode = AutoCompleteMode.Suggest
            .AutoCompleteSource = AutoCompleteSource.CustomSource
            .AutoCompleteCustomSource = collection
        End With
    End Sub

Private Sub dgvEntry_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles dgvEntry.EditingControlShowing
        If dgvEntry.CurrentCell.ColumnIndex = TaxCodeCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_taxCodeAutoComplete.Codes)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = TaxDescriptionCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_taxCodeAutoComplete.Descriptions)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = NominalCodeColumn.Index Then
            SetEditingControlShowing(e:=e, collection:=_nominalCodeAutoCompelte)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = NominalDescriptionCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_nominalAutoComplete.Descriptions)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = DepartmentNumberCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_departmentId)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = DepartmentCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_departmentDescription)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = ManagerCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_managers)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = CostCodeCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_costCodeAutoComplete.Codes)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = CostDescriptionCol.Index Then
            SetEditingControlShowing(e:=e, collection:=_costCodeAutoComplete.Descriptions)
        ElseIf dgvEntry.CurrentCell.ColumnIndex = InvoiceDateCol.Index Then
        Else
            SetEditingControlShowing(e:=e, collection:=Nothing)
        End If
    End Sub

There has been no error messages as the program hangs but as explained in background section the resource manager gives an error stating 'one or more threads of "ProgramName" are waiting to finish network I/O.'

cbradley
  • 81
  • 4
  • 1) Just on the off-chance, does it get any better if you put `.AutoCompleteCustomSource = collection` before `.AutoCompleteSource = AutoCompleteSource.CustomSource`? 2) Also, are you using [`Option Strict On`](https://stackoverflow.com/a/29985039/1115360) as should be done? – Andrew Morton Jul 23 '19 at 08:34
  • Thanks Andrew you were right about strict not being on. (Why the program was running fine in the emulator). Changing about the AutoCompleteSource does not seem to fix the problem though. – cbradley Jul 23 '19 at 08:56
  • What do you want to happen when `collection` has not been populated yet? It might help if you could [edit] the question to add the code which populates it. – Andrew Morton Jul 23 '19 at 09:17

0 Answers0