Click here to Skip to main content
15,888,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear code lovers

I have a combo box with me filled with default values ..... I need to load new form by clicking a value of combo box

let's say I want to load student details form after selecting a "John"

Any one help me to sort it out?


thanks
Posted
Comments
Mitchell J. 13-Jan-14 6:29am    
What have you tried yourself?
BillWoodruff 13-Jan-14 7:18am    
Are you talking about loading an instance of a predefined Form which you've created but are currently not showing ? Are you talking about loading a different Form for some, or all, Items clicked in the ComboBox ? Or, are you talking about actually creating a new instance of a Form every time any Item in the ComboBox is clicked ?

1 solution

C#
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    ComboBox senderComboBox = (ComboBox) sender;

    Form1 form = new Form1();
    // You can check senderComboBox.SelectedText or other here
    form.Text = senderComboBox.SelectedItem.ToString();
    form.ShowDialog();
}

Refer:http://stackoverflow.com/questions/11716179/calling-new-form-by-clicking-an-item-in-the-combobox-in-c-sharp[^]

This may help.
 
Share this answer
 

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