Public Class Form1
Private m_EscapeKeyPressed As Boolean = False
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
m_EscapeKeyPressed = (e.KeyCode = Keys.Escape)
End Sub
End Class
who to use m_EscapeKeypressed to the Loop?
For Example loop code is :
VB.NET:dim x as integer = 0 do while x < 100000000 . . . . x = x + 1 loop
dim x as integer = 0
m_EscapeKeyPressed = False
do while x < 100000000 AndAlso m_EscapeKeyPressed = False
.
.
.
.
x += 1 'Same as x = x + 1, just less code
loop
With ProgressBar1
.Minimum = 0
.Value = 0
.Maximum = 100000
m_EscapeKeyPressed = False
Dim x As Integer = .Minimum
Do While x < .Maximum AndAlso m_EscapeKeyPressed = False
ProgressBar1.Value = x
Me.Text = x.ToString
Application.DoEvents()
x += 1
Loop
End With