Click here to Skip to main content
15,920,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I make combo box, its data retrieved from a DB Table, I assign to it Data Source & Display Member & Value Member, Everything working well; but in run-time, when i change selected data the label of first item in list changed to selected one label and never come back to its original(correct Label), all other items also through changing the selection their labels become conflicted, (i.e I lose the label of the selected item (member) when i select another one) and I don't why this conflict happen.

I hope you can help me

Mohammed Abulhaija
Posted
Comments
qadirv 12-Nov-11 8:20am    
Can you please post your code so that others may help you
Mohammed Abul-Haija 12-Nov-11 16:09pm    
////* Initialization *////
//=====================//
this.yEAR_NAMEComboBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.sTUDY_YEARBindingSource, "YEAR_NAME", true));
this.yEAR_NAMEComboBox.DataSource = this.sTUDY_YEARBindingSource;
this.yEAR_NAMEComboBox.DisplayMember = "YEAR_NAME";
this.yEAR_NAMEComboBox.Font = new System.Drawing.Font("Traditional Arabic", 14.25F, System.Drawing.FontStyle.Bold);
this.yEAR_NAMEComboBox.ForeColor = System.Drawing.Color.Red;
this.yEAR_NAMEComboBox.FormattingEnabled = true;
this.yEAR_NAMEComboBox.Location = new System.Drawing.Point(242, 52);
this.yEAR_NAMEComboBox.Name = "yEAR_NAMEComboBox";
this.yEAR_NAMEComboBox.Size = new System.Drawing.Size(121, 37);
this.yEAR_NAMEComboBox.TabIndex = 2;
this.yEAR_NAMEComboBox.ValueMember = "YEAR_NAME";

////* Form Load *////
//================//
this.sTUDY_YEARTableAdapter.Fill(this.MyDataSet.STUDY_YEAR);
============================================================

This Code at run-time fill the ComboBox with These Data:
2011/2012
2012/2013
2013/2014
2014/2015
2015/2016
.... etc.

When I select f.g 2012/2013 (second choice), the label of first choice changed from 2011/2012 to 2012/2013. Also, When I choose f.g 2014/2015 (fourth choice) after that the label of first choice changed again to 2014/2015 and the second choice also changed to 2014/2015 label also and go on .... .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900