{"id":78,"date":"2013-09-23T14:10:05","date_gmt":"2013-09-23T18:10:05","guid":{"rendered":"http:\/\/passionwind.com\/techref\/?p=78"},"modified":"2013-11-21T08:53:14","modified_gmt":"2013-11-21T13:53:14","slug":"simple-wait-routine-in-vb-net","status":"publish","type":"post","link":"http:\/\/techref.camellarry.com\/?p=78","title":{"rendered":"Simple wait routine in VB.NET"},"content":{"rendered":"<p><span style=\"font-family: 'courier new', courier;\">Public Class Form1<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier;\">\u00a0 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load<br \/>\nHoldYourpants(2) &#8216; wait 2 seconds<br \/>\nHoldYourWater(2) &#8216; more efficient code<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier;\">\u00a0 End Sub<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier;\">\u00a0 Public Sub HoldYourPants(ByVal PauseTime As Integer)<\/span><br \/>\n<span style=\"font-family: 'courier new', courier;\"> \u00a0 \u00a0 Dim Start As Double<\/span><br \/>\n<span style=\"font-family: 'courier new', courier;\"> \u00a0 \u00a0 Start = Microsoft.VisualBasic.Timer &#8216; Set start time.<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier;\">\u00a0 \u00a0 Do While Microsoft.VisualBasic.Timer &lt; Start + PauseTime<\/span><br \/>\n<span style=\"font-family: 'courier new', courier;\"> \u00a0 \u00a0 \u00a0 Application.DoEvents()<\/span><br \/>\n<span style=\"font-family: 'courier new', courier;\"> \u00a0 \u00a0 Loop<\/span><br \/>\n<span style=\"font-family: 'courier new', courier;\"> \u00a0 End Sub<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier;\">\u00a0 Public Sub HoldYourWater(ByVal Seconds As Integer)<\/span><br \/>\n<span style=\"font-family: 'courier new', courier;\">\u00a0 \u00a0 System.Threading.Thread.Sleep(Seconds * 1000)<br \/>\n<\/span><span style=\"font-family: 'courier new', courier;\">\u00a0 End Sub<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier;\">End Class<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Public Class Form1 \u00a0 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load HoldYourpants(2) &#8216; wait 2 seconds HoldYourWater(2) &#8216; more efficient code \u00a0 End Sub \u00a0 Public Sub HoldYourPants(ByVal PauseTime As Integer) \u00a0 \u00a0 Dim Start As Double \u00a0 \u00a0 Start = Microsoft.VisualBasic.Timer &#8216; Set start time. \u00a0 \u00a0 Do While Microsoft.VisualBasic.Timer &lt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[58,77,78,79],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-vb-net","tag-programming","tag-vb-net","tag-visualbasic","tag-wait"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9t3oE-1g","_links":{"self":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":9,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":279,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/279"}],"wp:attachment":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}