(vb.net) Stop a thread execution on a button click
I'm a beginner in vb.net and my first project is build to check out if the internet is up our down. To do it, I want to start a thread, on a "start button" click. Once started, the sub execute a ping on three different web site in a loop until I click the stop button. When I click the "stop button", I would like to set a public boolean to "true" to force the sub to stop looping and let it end by itself. How can I do that? By clicking a button, how can I change the value of a boolean defined in the sub of this thread?
suppose u have two buttons and one boolean variable declared.Suppose the two buttons have their click event handlers respectively.
private System.Windows.Forms.Button Start;
private System.Windows.Forms.Button Stop;
private void Start_Click(object sender, System.EventArgs e)
//do some work
private void Stop_Click(object sender, System.EventArgs e)
I was wondering if your ping routine was done and working correctly... i'm trying to do something similar but I sometimes get weird results... I took the routine from a forum, just wondering where is yours coming from or if you built it yourself.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center