我认为我的代码有问题 [英] I think my code has problem

查看:73
本文介绍了我认为我的代码有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行了我的代码然后在Windows上显示了很多表单,我不知道为什么。我已经有共享代码和下面的图片

感谢您的帮助



我尝试过:



这是我的代码

I ran my code then it showed many form on windows, I don't know why. I already have shared code and the picture below
Thanks for helping

What I have tried:

This is my code

public class Mean
        {
            static public string nghia;

        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            string a = null, text = null;
            a = Clipboard.GetText();
            text = a.ToLower();
            for (int i = 0; i < cbbtu.Items.Count; i++)
            {
                if (cbbtu.Items[i].ToString() == text)
                {
                    cbbtu.SelectedIndex = i;
                    Form clipbr = new clp();
                    clipbr.Show();
                }
            }
        }



这是问题

abc.png - Google云端硬盘 [ ^ ]

推荐答案

如果要显示每个表单一个另一个,然后使用ShowDialog而不是Show显示它 - 代码将停止并等待新表单关闭然后继续循环。



但是你创建的每个表单都会显示相同的东西 - 你可能需要在clp表单中添加一个属性或构造函数,以便发送数据供它显示。
If you want to show each form one after the other, then use ShowDialog instead of Show to display it - the code will then "stop" and wait for the new form to be closed before continuing with the loop.

But each form you create will show the same thing - you probably need to add a property or constructor to the clp form in order to send it data for it to display.


这篇关于我认为我的代码有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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