Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
QuestionFastest way to modify the value in the dictionary Pin
Gilbert Consellado16-Oct-15 12:51
professionalGilbert Consellado16-Oct-15 12:51 
AnswerRe: Fastest way to modify the value in the dictionary Pin
BillWoodruff16-Oct-15 21:54
professionalBillWoodruff16-Oct-15 21:54 
GeneralRe: Fastest way to modify the value in the dictionary Pin
Gilbert Consellado17-Oct-15 19:01
professionalGilbert Consellado17-Oct-15 19:01 
QuestionCreating Events with Dynamically created ComboBox(es) Pin
KakitaIppatsu16-Oct-15 11:30
KakitaIppatsu16-Oct-15 11:30 
AnswerRe: Creating Events with Dynamically created ComboBox(es) Pin
Brisingr Aerowing16-Oct-15 15:32
professionalBrisingr Aerowing16-Oct-15 15:32 
AnswerRe: Creating Events with Dynamically created ComboBox(es) Pin
BillWoodruff16-Oct-15 22:14
professionalBillWoodruff16-Oct-15 22:14 
GeneralRe: Creating Events with Dynamically created ComboBox(es) Pin
KakitaIppatsu20-Oct-15 9:02
KakitaIppatsu20-Oct-15 9:02 
AnswerRe: Creating Events with Dynamically created ComboBox(es) Pin
NeillJam18-Oct-15 22:02
NeillJam18-Oct-15 22:02 
Hi all,

If you know all the ComboBoxes are inside the panel, why not just iterate of the Panel's ComboBox controls?


foreach (ComboBox cBox in panel1.Controls)
{
    cBox.SelectedIndexChanged += cBox_SelectedIndexChanged;
}


Then when any of the ComboBox's SelectedIndexChanged events fire, you capture which one it is and do what needs to be done. eg.

void cBox_SelectedIndexChanged(object sender, EventArgs e)
{
    var currentComboBox = sender as ComboBox;

    if (currentComboBox == null)
          return;

    MessageBox.Show(currentComboBox.SelectedItem.ToString());
}


Neill
AnswerRe: Creating Events with Dynamically created ComboBox(es) Pin
Foothill19-Oct-15 11:19
professionalFoothill19-Oct-15 11:19 
GeneralRe: Creating Events with Dynamically created ComboBox(es) Pin
Pete O'Hanlon19-Oct-15 22:52
mvePete O'Hanlon19-Oct-15 22:52 
GeneralRe: Creating Events with Dynamically created ComboBox(es) Pin
Foothill20-Oct-15 3:58
professionalFoothill20-Oct-15 3:58 
QuestionHow to resolve network related or instance specific error Pin
Member 1200209515-Oct-15 20:26
Member 1200209515-Oct-15 20:26 
AnswerRe: How to resolve network related or instance specific error Pin
OriginalGriff15-Oct-15 21:37
mveOriginalGriff15-Oct-15 21:37 
AnswerRe: How to resolve network related or instance specific error Pin
NeillJam15-Oct-15 22:16
NeillJam15-Oct-15 22:16 
GeneralRe: How to resolve network related or instance specific error Pin
Member 1200209515-Oct-15 22:37
Member 1200209515-Oct-15 22:37 
GeneralRe: How to resolve network related or instance specific error Pin
NeillJam15-Oct-15 23:05
NeillJam15-Oct-15 23:05 
AnswerRe: How to resolve network related or instance specific error Pin
NeillJam15-Oct-15 23:24
NeillJam15-Oct-15 23:24 
QuestionHow do I download big file of applications Pin
Member 1201610615-Oct-15 14:58
Member 1201610615-Oct-15 14:58 
SuggestionRe: How do I download big file of applications Pin
Richard MacCutchan15-Oct-15 23:03
mveRichard MacCutchan15-Oct-15 23:03 
GeneralRe: How do I download big file of applications Pin
Member 1201610615-Oct-15 23:31
Member 1201610615-Oct-15 23:31 
GeneralRe: How do I download big file of applications Pin
molesworth16-Oct-15 2:43
molesworth16-Oct-15 2:43 
AnswerRe: How do I download big file of applications Pin
Richard Deeming16-Oct-15 2:44
mveRichard Deeming16-Oct-15 2:44 
QuestionI try to dynamically generate a name for my objects Pin
Member 1019526215-Oct-15 10:41
Member 1019526215-Oct-15 10:41 
AnswerRe: I try to dynamically generate a name for my objects Pin
BillWoodruff15-Oct-15 18:56
professionalBillWoodruff15-Oct-15 18:56 
GeneralRe: I try to dynamically generate a name for my objects Pin
Member 1019526219-Oct-15 7:11
Member 1019526219-Oct-15 7:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.