How to change selected row if another row is selected

2 posts, 0 answers
  1. Jerry
    Jerry avatar
    41 posts
    Member since:
    Mar 2012

    Posted 11 Nov 2013 Link to this post

    Hello,

    I have a multicolumn combo box that I can't seem to set the value.  When the selectindex is fired for this combobox I do a check of the data the user has worked with.  If there is a missing value I pop up a message box which works but i'm unable to reset the selected value to something else.  It keeps the selected value the user set to notify the group that they are finished with this job.  Since there was an error I want to reset the combobox to a different value.  I've tried so many things but nothing seems to work.  Here is a few of the things I tried.

    cbStatus.ValueMember = "value";
    cbStatus.DataSource = GetStatusCodes();  //Gets data from a data table
    cbStatus.AutoSizeDropDownToBestFit = true;
     
    //Binding
    cbStatus.DataBindings.Clear();
    cbStatus.DataBindings.Add("SelectedValue", bs, "status");
     
     
    //I've tried all the below code and it doesn't change my combox selected row or value
     
    //((RadGridView)this.cbStatus.EditorControl).Rows[2].IsSelected = true;
    //((RadGridView)this.cbStatus.EditorControl).CurrentColumn = ((RadGridView)this.cbStatus.EditorControl).Columns[0];
    //((DataTable)bs.DataSource).Rows[bs.Position]["status"] = "02";
    ///cbStatus.SelectedIndex = 2;
     
     
    When I add a watch on the below lines I get "01" and "Complete".  It should change to "02" and "Working"
     
    ((RadGridView)this.cbStatus.EditorControl).CurrentRow.Cells[0].Value "01" object {string}
    ((RadGridView)this.cbStatus.EditorControl).CurrentRow.Cells[1].Value "Complete" object {string}
  2. Jerry
    Jerry avatar
    41 posts
    Member since:
    Mar 2012

    Posted 12 Nov 2013 Link to this post

    Can anyone point me in the right direction please?

    Within an event called multicolumnComboBox1_SelectedIndexChanged, Can I set the selectedvalue like this
    multicolumnComboBox1.SelectedValue = "03";  ?

    Thank you
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top