我如何在C#中使用多线程 [英] How do i use multithreading in C#
问题描述
我在表单中有两个列表框和四个按钮.分别名为start1,stop1,start2,stop2的按钮.当我按下start1按钮时,从1开始的数字将显示在listbox1中,并且过程正在进行当我单击下一个start2按钮时,将从1开始的数字将显示在listbox2中,依此类推.当我单击stop1按钮时,应该停止在listbox1中显示数字的过程.与stop2相同当我单击stop2按钮时,应该关闭在listbox2中显示数字的过程.您能帮助我解决查询问题吗?
请参阅我过去的回答: />
如何获取keydown事件在vb.net中的不同线程上操作 [此 [ ^ ]系列.
已添加到Sakryulov和Abhinav C#中的多线程概念 [ ^ ]和 ^ ]也可能会为您提供帮助.
I have two listboxses and four buttons in my form.The button named as start1,stop1,start2,stop2 respectively.When i am pressing start1 button the numbers starting from 1 are to be displayed in listbox1 and the process is going on continously.When i click the next start2 button the numbers starting from 1 are to be displayed in listbox2 and so on.As soon as i click on the stop1 button the process of displaying of numbers in listbox1 should be stop.And the same for stop2 button when i click stop2 button the process of displaying numbers in listbox2 should be close.Can you help me to solve my querry.
See my past Answers:
How to get a keydown event to operate on a different thread in vb.net[^]. Ignore the title: all directions in C#.
—SA
Have a look at this[^] series.
Added to Sakryulov and Abhinav Multithreading Concepts in C#[^]and Multithreading[^] also might help you.
这篇关于我如何在C#中使用多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!