0

Hi, Everyone, i'm here with another problem, I'm working with a windows form where i am adding Panels programmaticaly. With same time when its busy with adding Panels to form I want to work, like- Loading another form or do another command in another form. plz help, here is my code samples,

  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        For i As Integer = 0 To 99

            Dim B As New Panel
            Dim C As New RichTextBox

            Me.Controls.Add(B)

            B.BackColor = Color.Coral
            B.Height = 130
            B.Width = 200
            B.Left = ((i Mod 5) * 211) + 30
            B.Top = ((i \ 5) * 141) + 10
            B.Name = i

            B.Controls.Add(C)
            C.Name = B.Name + "RTB" + i
            C.Tag = "RTB" + i

        Next
    End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Timer1.Enabled = True
End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        If ii < 101 Then
            CircleProgressBar1.Percentage = ii
            ii = ii + 1
        End If

        If ii >= 101 Then
            Timer1.Enabled = False
            ii = 1
        End If
    End Sub



 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        me.hide()
        form2.show()
    End Sub

Now, when i run the program, its continue to add 100 panels as i coded. but same time i cant click on Button1 or Button2. I have to wait for form load completion, taking almost 2/3 mins.
I need a solution to work with Form2 when Form1 continues to load and finish itself on background.
Please help me...

3
Contributors
3
Replies
8
Views
4 Years
Discussion Span
Last Post by Reverend Jim
0

You need to use threadin concept here.. The creating panle should be in a thread and call the thread in form load. When give thread a sleep time so that the form is active and can be used by users. Please read about using thread or background worker on internet for more clear understanding.

0

Hi, I read about background worker, but not sure how to implement on Object creating. all working with string or integer value, Can you plz explain me a bit on starting point?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.