i have written a code in vb.net. Its design contains buttons to execute various steps. Now i want my code to execute automatically run when I debug without pressing any buttons
You could use conditional compiler directives (#). For buttons there is the PerformClick method that can be called, else put the code in a method and call the method both from event handler and elsewhere.
VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
#If DEBUG Then
Button1.PerformClick()
#End If
End Sub
The code inside the #If block here is only compiled into Debug builds.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.