????? ????? ?????? ??????? ?? Visual Basic .NET ?? Visual Basic 2005

?????? ????????? ?????? ?????????
???? ???????: 315577 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ????? ?????? ??????? ?? ????? Microsoft Visual Basic .NET ?? Microsoft Windows 2005 Visual Basic. ???? ????? ????? System.Threading ?????? ???? ??? ?? ???? ???? ????? ?? ?????? ???????.

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • Microsoft Windows 2000 ?? Microsoft Windows XP
  • Microsoft Visual Basic .NET ?? Microsoft Visual Basic 2005
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • ????? Visual Basic .NET ?? ????? Visual Basic 2005
  • Visual Studio .NET ?? ???? ??????? ????????? Visual Studio 2005 (IDE)
  • ?????? ?????? ?? ???????? "?" ???? ???????
  • ?????? ?????? ?? Visual Basic .NET ?? Visual Basic 2005

????? ????? Visual Basic .NET ?? 2005 Visual Basic ?? ?????? ???????

  1. ??? ????? Microsoft Visual Studio .NET ?? Microsoft Visual Studio 2005.
  2. ????? ????? Visual Basic ????? Windows ???? ???? ThreadWinApp.
  3. ????? ???? ???? ?? ??? ???????. ????? ???? Button1 ???? ???????.
  4. ????? ???? ProgressBar ??? ???????. ????? ???? ?????? ProgressBar1 ???? ???????.
  5. ???? ??? ?????? ?????? ??? ??????? ?? ???? ??? ??? ????????? ????????.
  6. ????? ??????? ??????? ??? ????? ?????:
    Imports System.Threading
    					
  7. ????? ????? ????? ?????? ???? ?? ??? Button1:
    Private Sub Button1_Click( _
        ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles Button1.Click
    
        MessageBox.Show("This is the main thread")
    End Sub
    					
  8. ????? ??????? ?????? ??? ??? Form1:
    Private trd As Thread
    					
  9. ??? ??????? ?????? ??? ??? Form1:
    Private Sub ThreadTask()
        Dim stp As Integer
        Dim newval As Integer
        Dim rnd As New Random()
    
        Do
            stp = ProgressBar1.Step * rnd.Next(-1, 2)
            newval = ProgressBar1.Value + stp
            If newval > ProgressBar1.Maximum Then
                newval = ProgressBar1.Maximum
            ElseIf newval < ProgressBar1.Minimum Then
                newval = ProgressBar1.Minimum
            End If
    
            ProgressBar1.Value = newval
    
            Thread.Sleep(100)
        Loop
    End Sub
    						
    ??????: ??? ?? ??? underlies ???? ???????. ??? ????? ?? infinite ???? ??? ?????? ???????? ?? decrements ?????? ?? ProgressBar1 ????????? ?? 100 ???? ????? ??? ?? ?????.
  10. ????? ????? ????? Load ??????? ?? ??? Form1. ??? ???????? ???????? ????? ???? ????? ???? ???? ???? ??????? ???? ????? ????? ? ?? ??? ????? ???? ???????.
    Private Sub Form1_Load( _
        ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles MyBase.Load
    
        trd = New Thread(AddressOf ThreadTask)
        trd.IsBackground = True
        trd.Start()
    End Sub
    					

???? ?? ??? ????

  1. ?????? ??????? ???????. ???? ???? ?????? ?? ???? ?????? ???? ??????. ??? ?? ???? ????? ???? ?? ???????.
  2. ???? ?? ???? ??????? ??????? ?????? ?? ???? ??????? ???? ?????? ???? ProgressBar ? ???? ??? ???? ?? ???????. ???? ????? ???? ??????? ???????:
    This is the main thread
    							
    ????? ??? ???????. ???? ?? ?????? ???????? ?? ???? ?????? ????? ?? ?????.

??????? ??????? ????????

?? ??????? ???? ??????? ???? ?? ?????? ?????? ????? ?????? ??? ?????? ??? ??????? ????????. ????? ?? ?????????? ???? ???? SyncLock ????????? ??? ????? ?? ????? "??????? Visual Basic ??? ??????".

???????

???? ???????: 315577 - ????? ??? ??????: 15/?? ??????/1427 - ??????: 4.3
????? ???
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
????? ??????: 
kbmt kbvs2005swept kbvs2005applies kbhowtomaster KB315577 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????315577

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com