private void cbCmdElemType_SelectedIndexChanged(object sender, EventArgs e) { // изменение типа элементов if (modbusCmd != null) { ElemType newElemType = (ElemType)cbCmdElemType.SelectedIndex; if (modbusCmd.TableType == TableType.HoldingRegisters && newElemType == ElemType.Bool) { // отмена выбора типа Bool для регистров хранения cbCmdElemType.SelectedIndexChanged -= cbCmdElemType_SelectedIndexChanged; cbCmdElemType.SelectedIndex = (int)modbusCmd.ElemType; cbCmdElemType.SelectedIndexChanged += cbCmdElemType_SelectedIndexChanged; } else { modbusCmd.ElemType = newElemType; numCmdElemCnt.Value = ModbusUtils.GetElemCount(modbusCmd.ElemType); OnObjectChanged(TreeUpdateTypes.None); } } }