<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2FGUI%2FGUI_Thread</id>
		<title>VB.Net Tutorial/GUI/GUI Thread - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net_Tutorial%2FGUI%2FGUI_Thread"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/GUI/GUI_Thread&amp;action=history"/>
		<updated>2026-04-05T22:01:44Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/GUI/GUI_Thread&amp;diff=3834&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/GUI/GUI_Thread&amp;diff=3834&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net_Tutorial/GUI/GUI_Thread&amp;diff=3835&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net_Tutorial/GUI/GUI_Thread&amp;diff=3835&amp;oldid=prev"/>
				<updated>2010-05-26T12:57:03Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Create control in a separate thread==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Threading&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class AddControlInThread&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
Public Class Form1&lt;br /&gt;
  Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
  Public Sub New()&lt;br /&gt;
    MyBase.New()&lt;br /&gt;
    &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
    InitializeComponent()&lt;br /&gt;
    &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
  End Sub&lt;br /&gt;
  &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
    If disposing Then&lt;br /&gt;
      If Not (components Is Nothing) Then&lt;br /&gt;
        components.Dispose()&lt;br /&gt;
      End If&lt;br /&gt;
    End If&lt;br /&gt;
    MyBase.Dispose(disposing)&lt;br /&gt;
  End Sub&lt;br /&gt;
  &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
  Private components As System.ruponentModel.IContainer&lt;br /&gt;
  &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
  &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
  &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
  Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
  Friend WithEvents Label1 As System.Windows.Forms.Label&lt;br /&gt;
  &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button()&lt;br /&gt;
        Me.Label1 = New System.Windows.Forms.Label()&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(8, 8)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(64, 32)&lt;br /&gt;
        Me.Button1.TabIndex = 0&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Test&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Label1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Label1.Location = New System.Drawing.Point(8, 64)&lt;br /&gt;
        Me.Label1.Name = &amp;quot;Label1&amp;quot;&lt;br /&gt;
        Me.Label1.Size = New System.Drawing.Size(272, 176)&lt;br /&gt;
        Me.Label1.TabIndex = 1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(292, 273)&lt;br /&gt;
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.Button1})&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
    Dim t1 As New Thread(AddressOf makecontrol)&lt;br /&gt;
    t1.Start()     &lt;br /&gt;
    makecontrol()  &lt;br /&gt;
  End Sub&lt;br /&gt;
  Private Sub makecontrol()&lt;br /&gt;
    Dim x As New Button()&lt;br /&gt;
    x.Name = &amp;quot;btnNew&amp;quot;&lt;br /&gt;
    x.Visible = True&lt;br /&gt;
    Try&lt;br /&gt;
      Me.Controls.Add(x)&lt;br /&gt;
    Catch Ex As System.ArgumentException&lt;br /&gt;
      MessageBox.Show(Ex.Message)&lt;br /&gt;
    End Try&lt;br /&gt;
  End Sub&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demonstrates using threads in a GUI==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&amp;quot;Visual Basic(R) 2005 for Programmers (2nd Edition) (Deitel Developer Series) (Paperback)&lt;br /&gt;
&amp;quot;by Harvey M. Deitel (Author), Paul J. Deitel (Author)&lt;br /&gt;
&amp;quot;Publisher: Prentice Hall PTR; 2 edition (June 6, 2006)&lt;br /&gt;
&amp;quot;Language: English&lt;br /&gt;
&amp;quot;ISBN-10: 013225140X&lt;br /&gt;
&amp;quot;ISBN-13: 978-0132251402&lt;br /&gt;
&lt;br /&gt;
&amp;quot;**************************************************************************&lt;br /&gt;
&amp;quot;* (C) Copyright 1992-2006 by Deitel &amp;amp; Associates, Inc. and               *&lt;br /&gt;
&amp;quot;* Pearson Education, Inc. All Rights Reserved.                           *&lt;br /&gt;
&amp;quot;*                                                                        *&lt;br /&gt;
&amp;quot;* DISCLAIMER: The authors and publisher of this book have used their     *&lt;br /&gt;
&amp;quot;* best efforts in preparing the book. These efforts include the          *&lt;br /&gt;
&amp;quot;* development, research, and testing of the theories and programs        *&lt;br /&gt;
&amp;quot;* to determine their effectiveness. The authors and publisher make       *&lt;br /&gt;
&amp;quot;* no warranty of any kind, expressed or implied, with regard to these    *&lt;br /&gt;
&amp;quot;* programs or to the documentation contained in these books. The authors *&lt;br /&gt;
&amp;quot;* and publisher shall not be liable in any event for incidental or       *&lt;br /&gt;
&amp;quot;* consequential damages in connection with, or arising out of, the       *&lt;br /&gt;
&amp;quot;* furnishing, performance, or use of these programs.                     *&lt;br /&gt;
&amp;quot;**************************************************************************&lt;br /&gt;
&lt;br /&gt;
Imports System.Threading&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class UsingThreadInGUI&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New frmGUIThreads)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
&lt;br /&gt;
Public Class frmGUIThreads&lt;br /&gt;
   Private letter1 As RandomLetters &amp;quot; first randomLetters object&lt;br /&gt;
   Private letter2 As RandomLetters &amp;quot; second randomLetters object&lt;br /&gt;
   Private letter3 As RandomLetters &amp;quot; third randomLetters object&lt;br /&gt;
   Private Sub frmGUIThreads_Load(ByVal sender As System.Object, _&lt;br /&gt;
      ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
      &amp;quot; create first thread&lt;br /&gt;
      letter1 = New RandomLetters(lblThread1)&lt;br /&gt;
      Dim firstThread As New Thread(New ThreadStart( _&lt;br /&gt;
         AddressOf letter1.Run))&lt;br /&gt;
      firstThread.Name = &amp;quot;Thread 1&amp;quot;&lt;br /&gt;
      firstThread.Start()&lt;br /&gt;
      &amp;quot; create second thread&lt;br /&gt;
      letter2 = New RandomLetters(lblTread2)&lt;br /&gt;
      Dim secondThread As New Thread(New ThreadStart( _&lt;br /&gt;
         AddressOf letter2.Run))&lt;br /&gt;
      secondThread.Name = &amp;quot;Thread 2&amp;quot;&lt;br /&gt;
      secondThread.Start()&lt;br /&gt;
      &amp;quot; create third thread&lt;br /&gt;
      letter3 = New RandomLetters(lblThread3)&lt;br /&gt;
      Dim thirdThread As New Thread(New ThreadStart( _&lt;br /&gt;
         AddressOf letter3.Run))&lt;br /&gt;
      thirdThread.Name = &amp;quot;Thread 3&amp;quot;&lt;br /&gt;
      thirdThread.Start()&lt;br /&gt;
   End Sub &amp;quot; frmGUIThreads_Load&lt;br /&gt;
   &amp;quot; close all threads associated with this application&lt;br /&gt;
   Private Sub frmGUIThreads_FormClosing(ByVal sender As System.Object, _&lt;br /&gt;
      ByVal e As System.Windows.Forms.FormClosingEventArgs) _&lt;br /&gt;
      Handles MyBase.FormClosing&lt;br /&gt;
      System.Environment.Exit(System.Environment.ExitCode)&lt;br /&gt;
   End Sub &amp;quot; frmGUIThreads_FormClosing&lt;br /&gt;
   Private Sub chkThread_CheckedChanged(ByVal sender As System.Object, _&lt;br /&gt;
      ByVal e As System.EventArgs) Handles chkThread1.CheckedChanged, _&lt;br /&gt;
      chkThread3.CheckedChanged, chkThread2.CheckedChanged&lt;br /&gt;
      If sender.Equals(chkThread1) Then&lt;br /&gt;
         letter1.Toggle()&lt;br /&gt;
      ElseIf sender.Equals(chkThread2) Then&lt;br /&gt;
         letter2.Toggle()&lt;br /&gt;
      ElseIf sender.Equals(chkThread3) Then&lt;br /&gt;
         letter3.Toggle()&lt;br /&gt;
      End If&lt;br /&gt;
   End Sub &amp;quot; chkThread_CheckedChanged&lt;br /&gt;
End Class &amp;quot; frmGUIThreads&lt;br /&gt;
&lt;br /&gt;
Public Class RandomLetters&lt;br /&gt;
   Private Shared generator As New Random() &amp;quot; for random letters&lt;br /&gt;
   Private suspended As Boolean = False &amp;quot; true if thread is suspended&lt;br /&gt;
   Private output As Label &amp;quot; Label for output&lt;br /&gt;
   Private threadName As String &amp;quot; name of the current thread&lt;br /&gt;
   &amp;quot; constructor&lt;br /&gt;
   Public Sub New(ByVal label As Label)&lt;br /&gt;
      output = label&lt;br /&gt;
   End Sub &amp;quot; New&lt;br /&gt;
   &amp;quot; delegate that allows method DisplayCharacter to be called&lt;br /&gt;
   &amp;quot; in the thread that creates and maintains the GUI       &lt;br /&gt;
   Delegate Sub DisplayDelegate(ByVal displayChar As Char)&lt;br /&gt;
   &amp;quot; method DisplayCharacter sets the Label&amp;quot;s Text property&lt;br /&gt;
   &amp;quot; in a thread-safe manner&lt;br /&gt;
   Private Sub DisplayCharacter(ByVal displayChar As Char)&lt;br /&gt;
      &amp;quot; output character in Label&lt;br /&gt;
      output.Text = threadName + &amp;quot;: &amp;quot; + displayChar&lt;br /&gt;
   End Sub &amp;quot; DisplayCharacter&lt;br /&gt;
   &amp;quot; place random characters in GUI&lt;br /&gt;
   Public Sub Run()&lt;br /&gt;
      &amp;quot; get name of executing thread&lt;br /&gt;
      threadName = Thread.CurrentThread.Name&lt;br /&gt;
      While True &amp;quot; infinite loop; will be terminated from outside&lt;br /&gt;
         &amp;quot; sleep for up to 1 second&lt;br /&gt;
         Thread.Sleep(generator.Next(1001))&lt;br /&gt;
         SyncLock Me &amp;quot; obtain lock&lt;br /&gt;
            While suspended &amp;quot; loop until not suspended&lt;br /&gt;
               Monitor.Wait(Me) &amp;quot; suspend thread execution&lt;br /&gt;
            End While&lt;br /&gt;
         End SyncLock&lt;br /&gt;
         &amp;quot; select random uppercase letter&lt;br /&gt;
         Dim displayChar As Char = ChrW(generator.Next(26) + 65)&lt;br /&gt;
         &amp;quot; display character on corresponding Label&lt;br /&gt;
         output.Invoke(New DisplayDelegate(AddressOf DisplayCharacter), _&lt;br /&gt;
            New Object() {displayChar})&lt;br /&gt;
      End While&lt;br /&gt;
   End Sub &amp;quot; Run&lt;br /&gt;
   &amp;quot; change the suspended/running state&lt;br /&gt;
   Public Sub Toggle()&lt;br /&gt;
      suspended = Not suspended &amp;quot; toggle bool controlling state&lt;br /&gt;
      &amp;quot; change label color on suspend/resume&lt;br /&gt;
      If suspended Then&lt;br /&gt;
         output.BackColor = Color.Red&lt;br /&gt;
      Else&lt;br /&gt;
         output.BackColor = Color.LightGreen&lt;br /&gt;
      End If&lt;br /&gt;
      SyncLock Me &amp;quot; obtain lock&lt;br /&gt;
         If Not suspended Then &amp;quot; if thread resumed&lt;br /&gt;
            Monitor.Pulse(Me)&lt;br /&gt;
         End If&lt;br /&gt;
      End SyncLock&lt;br /&gt;
   End Sub &amp;quot; Toggle&lt;br /&gt;
End Class &amp;quot; RandomLetters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()&amp;gt; _&lt;br /&gt;
Partial Public Class frmGUIThreads&lt;br /&gt;
   Inherits System.Windows.Forms.Form&lt;br /&gt;
   &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
   &amp;lt;System.Diagnostics.DebuggerNonUserCode()&amp;gt; _&lt;br /&gt;
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
      If disposing AndAlso components IsNot Nothing Then&lt;br /&gt;
         components.Dispose()&lt;br /&gt;
      End If&lt;br /&gt;
      MyBase.Dispose(disposing)&lt;br /&gt;
   End Sub&lt;br /&gt;
   &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
   Private components As System.ruponentModel.IContainer&lt;br /&gt;
   &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
   &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
   &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
   &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; _&lt;br /&gt;
   Private Sub InitializeComponent()&lt;br /&gt;
      Me.lblThread1 = New System.Windows.Forms.Label&lt;br /&gt;
      Me.lblTread2 = New System.Windows.Forms.Label&lt;br /&gt;
      Me.lblThread3 = New System.Windows.Forms.Label&lt;br /&gt;
      Me.chkThread1 = New System.Windows.Forms.CheckBox&lt;br /&gt;
      Me.chkThread2 = New System.Windows.Forms.CheckBox&lt;br /&gt;
      Me.chkThread3 = New System.Windows.Forms.CheckBox&lt;br /&gt;
      Me.SuspendLayout()&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;lblThread1&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.lblThread1.AutoSize = True&lt;br /&gt;
      Me.lblThread1.BackColor = System.Drawing.Color.LightGreen&lt;br /&gt;
      Me.lblThread1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle&lt;br /&gt;
      Me.lblThread1.Font = New System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
      Me.lblThread1.Location = New System.Drawing.Point(13, 9)&lt;br /&gt;
      Me.lblThread1.Name = &amp;quot;lblThread1&amp;quot;&lt;br /&gt;
      Me.lblThread1.Size = New System.Drawing.Size(63, 18)&lt;br /&gt;
      Me.lblThread1.TabIndex = 0&lt;br /&gt;
      Me.lblThread1.Text = &amp;quot;Thread 1:&amp;quot;&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;lblTread2&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.lblTread2.AutoSize = True&lt;br /&gt;
      Me.lblTread2.BackColor = System.Drawing.Color.LightGreen&lt;br /&gt;
      Me.lblTread2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle&lt;br /&gt;
      Me.lblTread2.Font = New System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
      Me.lblTread2.Location = New System.Drawing.Point(13, 34)&lt;br /&gt;
      Me.lblTread2.Name = &amp;quot;lblTread2&amp;quot;&lt;br /&gt;
      Me.lblTread2.Size = New System.Drawing.Size(63, 18)&lt;br /&gt;
      Me.lblTread2.TabIndex = 1&lt;br /&gt;
      Me.lblTread2.Text = &amp;quot;Thread 2:&amp;quot;&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;lblThread3&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.lblThread3.AutoSize = True&lt;br /&gt;
      Me.lblThread3.BackColor = System.Drawing.Color.LightGreen&lt;br /&gt;
      Me.lblThread3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle&lt;br /&gt;
      Me.lblThread3.Font = New System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
      Me.lblThread3.Location = New System.Drawing.Point(13, 59)&lt;br /&gt;
      Me.lblThread3.Name = &amp;quot;lblThread3&amp;quot;&lt;br /&gt;
      Me.lblThread3.Size = New System.Drawing.Size(63, 18)&lt;br /&gt;
      Me.lblThread3.TabIndex = 2&lt;br /&gt;
      Me.lblThread3.Text = &amp;quot;Thread 3:&amp;quot;&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;chkThread1&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.chkThread1.AutoSize = True&lt;br /&gt;
      Me.chkThread1.Font = New System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
      Me.chkThread1.Location = New System.Drawing.Point(116, 8)&lt;br /&gt;
      Me.chkThread1.Name = &amp;quot;chkThread1&amp;quot;&lt;br /&gt;
      Me.chkThread1.Size = New System.Drawing.Size(93, 20)&lt;br /&gt;
      Me.chkThread1.TabIndex = 3&lt;br /&gt;
      Me.chkThread1.Text = &amp;quot;Suspended&amp;quot;&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;chkThread2&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.chkThread2.AutoSize = True&lt;br /&gt;
      Me.chkThread2.Font = New System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
      Me.chkThread2.Location = New System.Drawing.Point(116, 33)&lt;br /&gt;
      Me.chkThread2.Name = &amp;quot;chkThread2&amp;quot;&lt;br /&gt;
      Me.chkThread2.Size = New System.Drawing.Size(93, 20)&lt;br /&gt;
      Me.chkThread2.TabIndex = 4&lt;br /&gt;
      Me.chkThread2.Text = &amp;quot;Suspended&amp;quot;&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;chkThread3&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.chkThread3.AutoSize = True&lt;br /&gt;
      Me.chkThread3.Font = New System.Drawing.Font(&amp;quot;Microsoft Sans Serif&amp;quot;, 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&lt;br /&gt;
      Me.chkThread3.Location = New System.Drawing.Point(116, 58)&lt;br /&gt;
      Me.chkThread3.Name = &amp;quot;chkThread3&amp;quot;&lt;br /&gt;
      Me.chkThread3.Size = New System.Drawing.Size(93, 20)&lt;br /&gt;
      Me.chkThread3.TabIndex = 5&lt;br /&gt;
      Me.chkThread3.Text = &amp;quot;Suspended&amp;quot;&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      &amp;quot;frmGUIThreads&lt;br /&gt;
      &amp;quot;&lt;br /&gt;
      Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)&lt;br /&gt;
      Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font&lt;br /&gt;
      Me.ClientSize = New System.Drawing.Size(221, 86)&lt;br /&gt;
      Me.Controls.Add(Me.chkThread3)&lt;br /&gt;
      Me.Controls.Add(Me.chkThread2)&lt;br /&gt;
      Me.Controls.Add(Me.chkThread1)&lt;br /&gt;
      Me.Controls.Add(Me.lblThread3)&lt;br /&gt;
      Me.Controls.Add(Me.lblTread2)&lt;br /&gt;
      Me.Controls.Add(Me.lblThread1)&lt;br /&gt;
      Me.Name = &amp;quot;frmGUIThreads&amp;quot;&lt;br /&gt;
      Me.Text = &amp;quot;GUI Threads&amp;quot;&lt;br /&gt;
      Me.ResumeLayout(False)&lt;br /&gt;
      Me.PerformLayout()&lt;br /&gt;
   End Sub&lt;br /&gt;
   Friend WithEvents lblThread1 As System.Windows.Forms.Label&lt;br /&gt;
   Friend WithEvents lblTread2 As System.Windows.Forms.Label&lt;br /&gt;
   Friend WithEvents lblThread3 As System.Windows.Forms.Label&lt;br /&gt;
   Friend WithEvents chkThread1 As System.Windows.Forms.CheckBox&lt;br /&gt;
   Friend WithEvents chkThread2 As System.Windows.Forms.CheckBox&lt;br /&gt;
   Friend WithEvents chkThread3 As System.Windows.Forms.CheckBox&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Thread Sleeps in a button&amp;quot;s action==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
public class SleepInButtonAction&lt;br /&gt;
   public Shared Sub Main&lt;br /&gt;
        Application.Run(New Form1)&lt;br /&gt;
   End Sub&lt;br /&gt;
End class&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, _&lt;br /&gt;
          ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Threading.Thread.Sleep(3000)&lt;br /&gt;
        MsgBox(&amp;quot;Good Morning&amp;quot;)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&amp;lt;Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()&amp;gt; _&lt;br /&gt;
Partial Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerNonUserCode()&amp;gt; _&lt;br /&gt;
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing AndAlso components IsNot Nothing Then&lt;br /&gt;
            components.Dispose()&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
    &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
    &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; _&lt;br /&gt;
    Private Sub InitializeComponent()&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(8, 8)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(168, 23)&lt;br /&gt;
        Me.Button1.TabIndex = 0&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Slow Greeting&amp;quot;&lt;br /&gt;
        Me.Button1.UseVisualStyleBackColor = True&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)&lt;br /&gt;
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(216, 39)&lt;br /&gt;
        Me.Controls.Add(Me.Button1)&lt;br /&gt;
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle&lt;br /&gt;
        Me.MaximizeBox = False&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;Pause Execution&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
End Class&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>