Free Support Forum - aspose.com

Getting information from a combo box added dynamically to GridDesktop

My application adds information to a grid desktop control and for two of the column adds combo box with options that the users can change if they want. I want to be able to detect if/when the user changes a value in the combo box so I can update other cells in the grid desktop.


The loop that adds the information to the sheet is:

For x As Integer = row To unitInformation.Samples.Count - 1
sampleInformation = unitInformation.Samples(x)
.Cells(row, 0).Value = sampleInformation.SampleNumber
.Cells(row, 1).Value = DustWipeComponentToString(sampleInformation.SampleType)
.Controls.AddComboBox(row, 1, ComponentOptions)
.Cells(row, 2).Value = sampleInformation.SampleDescription
.Cells(row, 3).Value = sampleInformation.Concentration & " " & UnitsToString(sampleInformation.ConcentrationUnit)
.Cells(row, 4).Value = sampleInformation.Result.ToString
.Controls.AddComboBox(row, 4, ResultOptions)
.Cells(row, 5).Value = sampleInformation.Comment
If sampleInformation.Result = DustWipeResults.Positive Then
.Rows(row).SetFont(PositiveFont)
End If
row += 1
Next

And the combo boxes options are stored in two list that are define at the top of the form:

Dim ResultOptions As List(Of String) = New List(Of String)(New String() {“Positive”, “Negative”})
Dim ComponentOptions As List(Of String) = New List(Of String)(New String() {“Floor”, “Window Sill”, “Window Well”})


I want to be able to detect when a user changes a row from Positive to Negative, and vice versa, or changes, for example, a Floor to a Window Well. Is there a way to add a handler to do this?

Hi,

I think you may use/handle “CellSelectedIndexChanged” event of GridDesktop control, the event is fired when you select/change any item in the combo box.

For further details, please check the demo i.e FormCellControl.cs/vb in the Aspose.Cells.GridDesktop demos, the featured demos are installed when you use Aspose.Cells.MSI installer, so you may open the demo solutions in your vs.net and check the sample code segments.

Thank you.