组合框帮助 [英] Combobox help

查看:68
本文介绍了组合框帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问这个问题真的很傻,但是...

第一次更改选择后,我正在使用组合框,我尝试更改选择,但是我的方法没有被调用.我不确定自己在做什么.

I feel really dumb asking this question but...

I am using a combobox after the selection is changed the first time, I try to change the selection and my method does not get invoked. I''m unsure of what I''m doing wrong.

names.SelectedIndexChanged += delegate
            {
                if (btn.Name.StartsWith("1"))
                    ptsValue = 100;
                else if (btn.Name.StartsWith("2"))
                    ptsValue = 200;
                else if (btn.Name.StartsWith("3"))
                    ptsValue = 300;
                else if (btn.Name.StartsWith("4"))
                    ptsValue = 400;
                else if (btn.Name.StartsWith("5"))
                    ptsValue = 500;
                else
                    ptsValue = 600;

                int score = 0;

                for (int i = 0; i < NamesFLC; i++)
                {

                    if (String.Compare(tableofNames[i], (string)names.SelectedItem, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        score = tableofPoints[i];
                        score += ptsValue;
                        tableofPoints[i] = score;
                    }
                }
                QuestionBox.Controls.Remove(names);
                QuestionBox.Controls.Remove(cls);
                QuestionBox.Controls.Remove(question);
                this.Controls.Remove(btn);
                QuestionBox.Close();
            };



我想要的是能够更改选择,并且每次都可以调用它.有没有一种方法可以重置控件,以便在第一次更改控件后会确认下一个更改?感谢您的所有帮助.



What I''m after is being able to change the selection and this being invoked EVERY time. Is there a way to reset the control such that after it''s changed the first time it will acknowledge the next change? Thank you for all your help

推荐答案

执行autopostback = true;用于组合框
Do autopostback=true; for the combobox


这篇关于组合框帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆