Combo box problem in Windows application

Posted on 2014-08-09
Last Modified: 2014-08-09
Can u please give example for below scenario
IN c# Windows application

when combo box  value is selected, dynamically label and text box should be created in the panel for entering the values from users prospective.
Question by:mannevenu26
    1 Comment
    LVL 74

    Accepted Solution

    One approach:

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        if (comboBox1.SelectedIndex < 0)
        switch (comboBox1.SelectedIndex)
            case 0:
                Label lbl1 = new Label() { Text = "A Label", Location = new Point(0, 0) };
                TextBox txt1 = new TextBox() { Text = "A TextBox", Location = new Point(0, lbl1.Bottom + 5) };
            case 1:
                Label lbl2 = new Label() { Text = "Another Label", Location = new Point(0, 0) };
                TextBox txt2 = new TextBox() { Text = "Another TextBox", Location = new Point(0, lbl2.Bottom + 5) };

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video discusses moving either the default database or any database to a new volume.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now