peter
peter

Reputation: 8682

How to generate text from dropdownbox while clicking

for example dropdown box contain three things Simon,Jaison,Rahul..if you click Jaison will generate jaison as a text,,or Simon will generate Simon as a text

Upvotes: 0

Views: 87

Answers (1)

Daniel LeCheminant
Daniel LeCheminant

Reputation: 51141

Your question is somewhat unclear, but if you're trying to get a string from the currently selected item (when the selection changes), then...

Handle the SelectedIndexChanged event:

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    string selectedText = comboBox1.SelectedItem.ToString();

    // Do whatever you want to do with it, for example...
    label1.Text = selectedText;
}

Upvotes: 1

Related Questions