Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1210
Ultra Combo Value Change event on Form Close
posted

Hi Mike,
               I have one ultra combo and Windows ComboBox in one winform with following settings :

       
private void Form1_Load( object sender, EventArgs e )
        {
          //creating dummy data
            DataTable dt = new DataTable();
            DataColumn col = new DataColumn( "ID", typeof( int ) );
            dt.Columns.Add( col );
            col = new DataColumn( "Name", typeof( string ) );
            dt.Columns.Add( col );

            DataRow row = dt.NewRow();
            row [ 0 ] = 1;
            row [ 1 ] = "aa";
            dt.Rows.Add( row );
            row = dt.NewRow();
            row [ 0 ] = 2;
            row [ 1 ] = "bb";
            dt.Rows.Add( row );

            dt.AcceptChanges();           

            DataTable business = new DataTable();
            col = new DataColumn( "BID", typeof( int ) );
            business.Columns.Add( col );
            row = business.NewRow();
            row [ 0 ] = 2;
            business.Rows.Add( row );

            //Win combo
            this.comboBox.DataSource = dt;
            this.comboBox.DisplayMember = "Name";
            this.comboBox.ValueMember = "Id";
            this.comboBox.DataBindings.Add( "SelectedValue", business, "BID", true, DataSourceUpdateMode.OnPropertyChanged );
            this.comboBox.SelectedValue = -1;
            this.comboBox.SelectedValueChanged += new EventHandler( comboBox1_SelectedValueChanged );

            //Ultra combo
            ultraCombo.AllowNull = Infragistics.Win.DefaultableBoolean.True;
            ultraCombo.NullText = "Unassigned";           
            ultraCombo.DataSource = dt;
            ultraCombo.ValueMember = "Id";
            ultraCombo.DisplayMember = "Name";
                       
            ultraCombo.DataBindings.Add( "Value", business, "BID", true, DataSourceUpdateMode.OnPropertyChanged );
            ultraCombo.Value = null;
            ultraCombo.ValueChanged += new EventHandler( ultraCombo_ValueChanged );
        }

        void comboBox1_SelectedValueChanged( object sender, EventArgs e )
        {
            MessageBox.Show( "Win : selected index changed" );
        }

        void ultraCombo_ValueChanged( object sender, EventArgs e )
        {
            MessageBox.Show( "Ultra combo : selected index changed" );
        }

If focus is in UltraCombo and selected value is null, On Close of form it is firing ValueChange event.
I tried same thing with windows ComboBox and it works fine(It wont fire value change event on form close).
Is there any way to stop this thing? Because in ValueChange event I am setting some flags and based on it I am showing warning message to save the changes. In my case without doint anything if we close form it is asking for Save.
Please reply me as soon as possible.

--
Thanks,
Ganesh
Parents Reply Children
No Data