when selected combo item then the item delete from comobox?

Posted by: smartzq on 8 September 2017, 2:34 pm EST

  • Posted 8 September 2017, 2:34 pm EST

    <P>there are four items in combo: "no use","one","two","three" , when I selected "one" in combox then this item  was delete from combo.Other combo cell only display "no use","two","three".</P>
    <P>if I change the "one" to "no use" then the other combo cell display "no use", "one","two","three"</P>
    <P>the "no use" item is always display in combo.</P>
    <P> </P>
    <P>thanks</P>
    2011/02/3.JPG
  • Replied 8 September 2017, 2:34 pm EST

    <p>Hello,</p><p>Can you send us the sample replicating the issue because this seems to be an issue with the way ComboboxCellTypes items have been set. We need to look at the code in order to proceed further.</p><p>Thanks.<br></p>
  • Replied 8 September 2017, 2:34 pm EST

    <P>I wrote these codes ,but I think maybe have better codes to solve .and I want to know how to use ".remove" and ".add". </P>
    <P>thanks </P>
    <P>    Private Sub FpSpread1_CellClick(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick<BR>        Dim combobox As New FarPoint.Win.Spread.CellType.ComboBoxCellType<BR>        combobox.Items = New String() {"no use", "one", "two", "three"}<BR>        Dim m As Integer<BR>        Dim n As Integer = 0<BR>        For m = 0 To FpSpread1.ActiveSheet.RowCount - 1<BR>            If FpSpread1.ActiveSheet.Cells(m, 0).Value = "one" Then<BR>                combobox.Items = New String() {"no use", "two", "three"}<BR>                n = 1<BR>            End If<BR>        Next<BR>        If n = 0 Then<BR>            combobox.Items = New String() {"no use", "one", "two", "three"}</P>
    <P>        End If<BR>        FpSpread1.ActiveSheet.Cells(e.Row, 0).CellType = combobox<BR>    End Sub</P>
  • Replied 8 September 2017, 2:34 pm EST

    <p>Hello,</p><p>Here is a better way to achieve the required functionality using ComboSelChange method and EditingControl. Please have a look at the code:-</p><blockquote><p>        FarPoint.Win.Spread.CellType.ComboBoxCellType combobox;
    <br>        string[] cbstr;
    <br>        public Form2()
    <br>        {
    <br>            InitializeComponent();
    <br>            cbstr = new String[] { "no use", "one", "two", "three" };
    <br>        }
    <br> <br>        private void Form2_Load(object sender, EventArgs e)
    <br>        {
    <br>            combobox = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
    <br>            combobox.Items = cbstr;
    <br>            fpSpread1.ComboSelChange+=new FarPoint.Win.Spread.EditorNotifyEventHandler(fpSpread1_ComboSelChange);
    <br>        }
    <br>        private void fpSpread1_ComboSelChange(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e)
    <br>        {
    <br>            FarPoint.Win.FpCombo combo = (FarPoint.Win.FpCombo)e.EditingControl;
    <br>            string value = ((FarPoint.Win.FpCombo)e.EditingControl).SelectedItem.ToString();
    <br>            if (value == "one")
    <br>                combobox.RemoveItem(1);
    <br>            else
    <br>                combobox.Items = cbstr;
    <br>        } </p></blockquote><p>Hope this will help you. Thanks. <br></p>
Need extra support?

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

Learn More

Forum Channels