DOEVENTS is similar as it is in the VB6.
Here is the simple code in VB.NET to test DOEVENT.
(Four buttons start, stop loop and reset variable, a message pop up during the loop is ON)
Public Class Form1
Public x As Integer = 0
Public y As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
While x = 0
y = y + 1
Label1.Text = y
System.Windows.Forms.Application.DoEvents()
End While
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
x = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
x = 1
MessageBox.Show("Loop Stopped")
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
MessageBox.Show("vikas")
End Sub
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
'MessageBox.Show("Activated")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MessageBox.Show("Form Loaded")
End Sub
End Class
No comments:
Post a Comment