C
czarvk
Guest
Hi, I am new to c# coding. I have a method that takes comboBox's name as input (such as comboMaterial1ProUsage, comboMaterial2ProUsage, .....comboMaterial10ProUsage)
I want to be able to dynamically invoke "SelectedChangeIndex" only for ComboBox that the method receives as an input. Currently since I do not know how to invoke only the "SelectedChangeIndex" for the comboBox that the method is executing for I am invoking all the methods.
Please note in the code below I stripped off all the unnecessary code and included only the piece that I have question on.
private void Method(ComboBox materialCombo)
{
this.comboMaterial1ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial1ProUsage_SelectedIndexChanged);
this.comboMaterial2ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial2ProUsage_SelectedIndexChanged);
this.comboMaterial3ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial3ProUsage_SelectedIndexChanged);
this.comboMaterial4ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial4ProUsage_SelectedIndexChanged);
this.comboMaterial5ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial5ProUsage_SelectedIndexChanged);
this.comboMaterial6ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial6ProUsage_SelectedIndexChanged);
this.comboMaterial7ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial7ProUsage_SelectedIndexChanged);
this.comboMaterial8ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial8ProUsage_SelectedIndexChanged);
this.comboMaterial9ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial9ProUsage_SelectedIndexChanged);
this.comboMaterial10ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial10ProUsage_SelectedIndexChanged);
}
svk
Continue reading...
I want to be able to dynamically invoke "SelectedChangeIndex" only for ComboBox that the method receives as an input. Currently since I do not know how to invoke only the "SelectedChangeIndex" for the comboBox that the method is executing for I am invoking all the methods.
Please note in the code below I stripped off all the unnecessary code and included only the piece that I have question on.
private void Method(ComboBox materialCombo)
{
this.comboMaterial1ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial1ProUsage_SelectedIndexChanged);
this.comboMaterial2ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial2ProUsage_SelectedIndexChanged);
this.comboMaterial3ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial3ProUsage_SelectedIndexChanged);
this.comboMaterial4ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial4ProUsage_SelectedIndexChanged);
this.comboMaterial5ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial5ProUsage_SelectedIndexChanged);
this.comboMaterial6ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial6ProUsage_SelectedIndexChanged);
this.comboMaterial7ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial7ProUsage_SelectedIndexChanged);
this.comboMaterial8ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial8ProUsage_SelectedIndexChanged);
this.comboMaterial9ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial9ProUsage_SelectedIndexChanged);
this.comboMaterial10ProUsage.SelectedIndexChanged += new System.EventHandler(this.comboMaterial10ProUsage_SelectedIndexChanged);
}
svk
Continue reading...