Posted 11 May 2020, 10:41 pm EST
I am doing something that should be real easy, and was in earlier versions of the Spreadsheet control.
I have a spreadsheet, the user double clicks on a cell and I change that cell from a General Cell to a Combo which I populate with options for selection. The user then clicks clicks the required selection and the combo closes. I get the Combo Close event, read the selection, set the cell type back to general and fill it with the test from the selection. Not exactly a trying task, but the Spreadsheet version has really made this complicated and I cannot get it to work.
This is a sample of the code calls:
Private Sub FpsInputChannels_CellDoubleClick(sender As Object, e As CellClickEventArgs) Handles FpsInputChannels.CellDoubleClick
Dim Row As Integer
Dim Col As Integer
Row = e.Row Col = e.Column If Col = 0 Then ' Input Channel Type Dim cbstr As String() cbstr = New String() {" 00: Unassigned", " 01: DeTVal IP", " 02: PCI-1716 AI", " 03: PCI-1747 AI", " 04: GANTNER AI", " 05: ADAM 4117 AI", " 06: DEVA Card 1 Hz", " 07: DEVA Card 2 Hz", " 08: ADAM 4118 TC", " 09: ADAM 4115 RTD", " 10: PCI-1716 DI", " 11: GANTNER DI", " 12: ADAM 4051 DI", " 13: ADAM 4052 DI", " 20:Software DI"} Dim cmbocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType() cmbocell.Items = cbstr cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter cmbocell.Editable = False cmbocell.MaxDrop = 8 FpsInputChannels.ActiveSheet.Cells(Row, Col).CellType = cmbocell End If
End Sub
Private Sub FpsInputChannels_ComboCloseUp(sender As Object, e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpsInputChannels.ComboCloseUp
Dim Row As Integer Dim Col As Integer Dim ChType As String Row = e.Row Col = e.Column If Col = 0 Then ChType = FpsInputChannels.ActiveSheet.GetValue(Row, Col) Dim gnrlcell As New FarPoint.Win.Spread.CellType.TextCellType() FpsInputChannels.ActiveSheet.Cells(1, 1).CellType = gnrlcell FpsInputChannels.ActiveSheet.SetValue(Row, Col, ChType) End If
End Sub
The first call works fine and does as expected.
The second call does not work. ChType is ALWAYS set to the first item in the list (which was the original value in the cell before converting to a COMBO). The Cell remains as a COMBO Box and does not change to a General Cell Type.
If someone could point to where I am going wrong and how I can achieve what should be a very simple task I would be very happy.
John