COMBO CELLTYPE can't assign value without Farpoint Win blowing up when I use Itemdata

Posted by: ruotols on 8 September 2017, 1:31 pm EST

  • Posted 8 September 2017, 1:31 pm EST

    I used to use this code on asp.net and now I am using vb.net windows.


    Cell type is combo.item = {"XXX","YYY","ZZZ"}


    .itemdata = {"100","200","300"}


    when the user logs in and the database has 200 stored I would like the combo box cell to default to 200 and display YYY.  I used to say cell.value = 200.  The code runs fine, but when the user clicks the horizonal scroll bar the grid throws an error and crashes 


     Am I doing it wrong?  I tried Editor.setvalue, that did not work either.


    Thanks


    Steve


     


     


     

  • Replied 8 September 2017, 1:31 pm EST

    Steve -

    You don't mention what version you are using.  I am not able to reproduce this so I would suggest making sure you have the latest maintenance release for the version you have.

  • Replied 8 September 2017, 1:31 pm EST

    I was using an older version - now I have 3.0.2009.2005 and can replicate it still in Visual Studio 2005


    Here is the code


    Dim oCellTypeDropDownSegments As New FarPoint.Win.Spread.CellType.ComboBoxCellType


     Dim cstrSegment As String()


    Dim cstrSegmentCode As String()


     


    Dim strLookupSegment(dsSegments.Tables("SEGMENTS").Rows.Count) As String


    Dim strLookupSegmentCode(dsSegments.Tables("SEGMENTS").Rows.Count) As String


    With dsSegments.Tables("SEGMENTS")


    For intloopcount = 0 To .Rows.Count - 1


    strLookupSegment(intloopcount) = _


    .Rows(intloopcount).Item("SEGMENT_CODE").ToString & " - " & _


    .Rows(intloopcount).Item("SEGMENT_NAME").ToString


    strLookupSegmentCode(intloopcount) = _


    .Rows(intloopcount).Item("SEGMENT_CODE").ToString


    Next


    End With


    cstrSegment = strLookupSegment


    cstrSegmentCode = strLookupSegmentCode


     


    oCellTypeDropDownSegments.Items = cstrSegment


    oCellTypeDropDownSegments.ItemData = cstrSegmentCode


    oCellTypeDropDownSegments.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter


    .Cells(intRow, PRODUCT_COLS.SEGMENT_CODE_IN_BRAND).CellType = oCellTypeDropDownSegments


    This line cause the grid to blow up when I click on the horizontal scroll bar


    grid.ActiveSheet.Cells(intloopcount, PRODUCT_COLS.SEGMENT_CODE_IN_BRAND).Value = (dsProducts.Tables("PRODUCTS").Rows(intloopcount).Item("SEGMENT_CODE_IN_BRAND").ToString)


     


    Am I missing a setting when instantiating the combo cell above?


     


     

  • Replied 8 September 2017, 1:31 pm EST

    I do not see this behavior in my own testing.  No exception is thrown when scrolling horizontally.  Do you have a small project you could attach showing this behavior?
  • Replied 8 September 2017, 1:31 pm EST

    Hello,


    What exception are you getting? Is the combobox showing the item until you scroll the Spread horizontally? One post you stated you are setting the Value property to 200, and then the code shows where you are passing in the 200 as a string "200". Have you set the EditorValue of the Combobox to ItemData. I think what Bob asked for in a small zipped project will be the most help to track down this issue.

  • Replied 8 September 2017, 1:31 pm EST

    I fixed the problem by adding this line of code


     


    .editorvalue = farpoint.win.spread.celltype.editorvalue.itemdata

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels