组合框和更改项目与选择

时间:2013-11-14 07:23:38

标签: combobox

我试图弄清楚如何设置我的代码,以便在组合框中选择一个选项时,它也会更改标签的文本。根据我的理解,它涉及一个叫做项目监听器的东西,但我们没有在课堂上讨论过这个问题。我们最近讨论了继承和接口,但我不知道这将如何应用。

1 个答案:

答案 0 :(得分:0)

//this event is fired whenever user selects or change a item from combobox

private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{

    //do whatever you want to do in this
}

 for android do this

  spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
        // your code here
    }

    @Override
    public void onNothingSelected(AdapterView<?> parentView) {
        // your code here
    }

});