blinking label

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Armin Zingler

    #16
    Re: blinking label

    "giannis" <zzzinobios@fre email.grschrieb
    The form2 have the label "please wait" and at the load event of
    form1 i write :
    >
    Dim t As New System.Threadin g.Thread(Addres sOf mySub)
    >
    t.Start()
    >
    Call mySub()
    Omit "Call mySub". t.Start already starts the sub because it's the thread's
    main procedure.

    You should also create Form2 within mySub.


    Armin

    Comment

    • giannis

      #17
      Re: blinking label

      Armin Zingler thank you very mutch for your helping
      understand threads.
      Now the blinking label works :

      Private Sub Form1_Load(ByVa l sender As Object, ByVal e As System.EventArg s)
      Handles Me.Load

      Dim t As New System.Threadin g.Thread(Addres sOf mySub)

      t.Start()


      Me.TABLETableAd apter.Fill(Me.D ATABASEDataSet. TABLE)

      Form2.Close()

      t.Abort()

      End Sub

      Sub mySub()

      Form2.Show()

      Form2.Refresh()

      Form2.Timer1.St art()

      Application.Run (Form2) ' or Application.Run () without the Form2

      End Sub


      Comment

      • Armin Zingler

        #18
        Re: blinking label

        "giannis" <zzzinobios@fre email.grschrieb
        Armin Zingler thank you very mutch for your helping
        understand threads.
        Now the blinking label works :
        Glad, I could help. Though, one additional comment:
        Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
        System.EventArg s) Handles Me.Load
        >
        Dim t As New System.Threadin g.Thread(Addres sOf mySub)
        >
        t.Start()
        >
        >
        Me.TABLETableAd apter.Fill(Me.D ATABASEDataSet. TABLE)
        >
        Form2.Close()
        >
        t.Abort()
        It's not necessary to call t.abort because the other thread will exit as
        soon as mySub has finished. Application.Run automatically exits after Form2
        has been closed, but only if you use Form2 as an argument.
        End Sub
        >
        Sub mySub()
        >
        Form2.Show()
        >
        Form2.Refresh()
        >
        Form2.Timer1.St art()
        >
        Application.Run (Form2) ' or Application.Run () without the Form2
        >
        End Sub


        Armin

        Comment

        Working...