listbox在C中不工作#

listbox在C中不工作#,listbox,Listbox,我想将项目添加到列表框中。 在按钮点击功能中,这是完全正确的。 但是,如果我把它放在其他函数中,它就不起作用了 或者换句话说,我可以在框中看到“开始”,但看不到“任务” 谢谢 private void button1_Click(object sender, EventArgs e) { MessageBox.Show("start"); listBox1.Items.Add("start"); token = textBox1.T

我想将项目添加到列表框中。 在按钮点击功能中,这是完全正确的。 但是,如果我把它放在其他函数中,它就不起作用了

或者换句话说,我可以在框中看到“开始”,但看不到“任务”

谢谢

    private void button1_Click(object sender, EventArgs e)
    {
        MessageBox.Show("start");
        listBox1.Items.Add("start");
        token = textBox1.Text;
        shipid = textBox2.Text;
        host = textBox3.Text;
        shipid = shipid.Replace(",", "%2C");
        System.Timers.Timer t = new System.Timers.Timer(5000);
        t.Elapsed += new System.Timers.ElapsedEventHandler(Mission3);
        t.AutoReset = true;
        t.Enabled = true;
    }
    private void Mission3(object source, System.Timers.ElapsedEventArgs e)
    {
        progress = action(progress, 0, 0, "0");
        listBox1.Items.Add("mission");
    }

这方面有很多问题……对不起,我对C#还是个新手,而且我没有太多编程经验。你能告诉我怎么做吗?