Can anyone tell me how I can let the user add their choices to a combobox? I have preset choices in each one, but would like to be able to let them add their own choices as well.

Recommended Answers

All 3 Replies

You can use:

comboBox1.Items.Add("test item");

well , you can by using text box ....

private void lstBoxEvents_SelectedIndexChanged
                                         (object sender, System.EventArgs e)
        {

//            this.txtBoxResult.Text = this.lstBoxEvents.Text;   
                                           // Single selection option
            string result  =" ";
            foreach(string activity  in lstBoxEvents.SelectedItems)
                result  += activity + "    ";
            this.txtBoxResult.Text = result;
        }

        private void btnNew_Click(object sender, System.EventArgs e)
        {
            lstBoxEvents.Items.Add(txtBoxNewAct.Text);
            txtBoxNewAct.Clear( );

okay got it working,,, Thank yaz :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.