{"id":1250,"date":"2006-04-03T17:48:00","date_gmt":"2006-04-03T07:48:00","guid":{"rendered":"http:\/\/new.radio-active.net.au\/web3\/1250\/"},"modified":"2014-10-10T12:25:15","modified_gmt":"2014-10-10T01:25:15","slug":"1250","status":"publish","type":"post","link":"http:\/\/www.radio-active.net.au\/web3\/1250","title":{"rendered":""},"content":{"rendered":"<p>Begin an rant&#8230; And more&#8230; on VisualStudio 2005.<\/p>\n<p>The first thing I wanted to do was to create a new thread to do some work. So the first thing that I need to do is to create a thread &#8211; an empty one. While we are at it we will also create a semaphore to indicate when the thread should be run.<\/p>\n<p><tt>Private thdLiveUpdate As Thread<br \/>Private Semaphore as Boolean = False<\/tt><\/p>\n<p>Then we just need to tell the thread to run out code&#8230; creating an instance of the thread if needed.<\/p>\n<p><tt><\/p>\n<pre>private sub RunThread()<br \/>    If thdLiveUpdate Is Nothing Then<br \/>        thdLiveUpdate = New Thread(AddressOf ThreadLiveUpdate)<br \/>    End If<br \/>    Semaphore = True<br \/>End Sub<\/pre>\n<p><\/tt><\/p>\n<p>This next bit of code will run a thread called ThreadLiveUpdate whenever Semaphore is true. In this case UpdateStatusBar is also important since we need to update the GUI from the thread.<\/p>\n<p><tt><\/p>\n<pre>Private Sub ThreadLiveUpdate()<br \/>    While True<br \/>        If Semaphore Then<br \/>            UpdateStatusBar(\"Updating Positions\")<br \/>            DoSomethingUseful()<br \/>             UpdateStatusBar(\"\")<br \/>            Semaphore = False<br \/>        End If<br \/>        System.Threading.Thread.Sleep(1000)<br \/>    End While<br \/>End Sub<br \/><\/pre>\n<p><\/tt><br \/>We wanted to use Me.StatusBar1.Text = &#8220;StatusBar1&#8221;, but this would be running in the wrong thread. So we get the update to run in another thread. Do do this we create a &#8216;Delegate&#8217;<\/p>\n<pre><tt>Delegate Sub UpdateStatusBarCallback(ByVal [TEXT] As String)<\/tt><\/pre>\n<p>Then we use the InvokeRequired to see if the function is in the correct thread space. Strangely I could not find an InvokeRequired function in the StatusBar that I was using so I used another graphical element.<\/p>\n<pre><span style=\"font-family:courier new;\">Private Sub UpdateStatusBar(ByVal [TEXT] As String)<br \/>    If Me.grdOutlook.InvokeRequired Then ' Not the right onject but it works<br \/>        Dim d As New UpdateStatusBarCallback(AddressOf UpdateStatusBar)<br \/>        Me.Invoke(d, New Object() {[TEXT]})<br \/>    Else<br \/>        Me.StatusBar1.Text = [TEXT]<br \/>    End If<br \/>End Sub<br \/><\/span><\/pre>\n<p>As I mentioned, I have a rant too&#8230; The problem is that I cannot work out how to move items on the TabStrip. It does not behave itself. Notice the place of the menu on the graphic below? I cannot work out how to move it&#8230; Can you spell BUG?<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/new.radio-active.net.au\/web3\/wp-content\/uploads\/2006\/04\/tag-300x34.png?resize=300%2C34\" data-recalc-dims=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Begin an rant&#8230; And more&#8230; on VisualStudio 2005. The first thing I wanted to do was to create a new thread to do some work. So the first thing that I need to do is to create a thread &#8211; &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"http:\/\/www.radio-active.net.au\/web3\/1250\">  Read More &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":3443,"comment_status":"closed","ping_status":"closed","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,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.radio-active.net.au\/web3\/wp-content\/uploads\/2006\/04\/tag.png?fit=812%2C93","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/s5cfmK-1250","_links":{"self":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts\/1250"}],"collection":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/comments?post=1250"}],"version-history":[{"count":0,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts\/1250\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/media\/3443"}],"wp:attachment":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/media?parent=1250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/categories?post=1250"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/tags?post=1250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}