小编Get*_*net的帖子

How to abort a while loop by clicking a button using C#

I have a function that displays numbers using a while loop but I want to stop execution of a while loop at random variable value using c# by clicking a button.

For Example:

private void FrqSent()
{
    int i = 1;
    while (i <= 5)       
    {  
        i = i + 1;
    }  
}
Run Code Online (Sandbox Code Playgroud)

c# loops break while-loop

2
推荐指数
1
解决办法
2104
查看次数

标签 统计

break ×1

c# ×1

loops ×1

while-loop ×1