I have a ComboBox that fills up at the touch of a button. One click - one fill. I need that on each press there is a reconciliation of the current element with all the previous ones, so that there are no repetitions. I decided to try this check:
for (int i = 0; i < comboBox1->Items->Count; i++) if (System::Convert::ToDouble(comboBox1->Items[i]) != x2) comboBox1->Items->Add(System::Convert::ToString(x2)); Without verification, the filling goes with a bang, but the elements can be repeated. This code refuses to work. That is, compile errors do not pop up, but the check is not performed. Tell me, please, how it would be possible to correct the condition to make it work.
x2and where it is installed. Try to give a so-called minimal reproducible example . In general, the likely problem is that you compare floating-point numbers through!=. - αλεχολυτ