Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:01:03+00:00 2026-06-09T13:01:03+00:00

Hello i’ve a loop that last about 2 hours to finish, it gets the

  • 0

Hello i’ve a loop that last about 2 hours to finish, it gets the data from internet and fills it to a database so i want to divide it to 4 threads, and i am trying to do some testing before i put this to my application.

so here is a sample that i wrote to fill one database by 4 threads
and i am getting this error “BindingSource cannot be its own data source”

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.DataGridView1.DataSource = Me.bindingSource1
    GetData("select * from products")
End Sub

 Public Sub thread1f0()
    For i = 0 To 500
        DataGridView1.Item("PD", i).Value = i + 67
        DataGridView1.Item("PDP", i).Value = i + 41
        DataGridView1.Item("TPD", i).Value = i + 654 + 6 * 13
        DataGridView1.Item("TPDP", i).Value = i + 342
    Next
End Sub

Public Sub thread1f1()
    For i = 501 To 1000
        DataGridView1.Item("PD", i).Value = i + 432
        DataGridView1.Item("PDP", i).Value = i + 421
        DataGridView1.Item("TPD", i).Value = i + 414
        DataGridView1.Item("TPDP", i).Value = i + 42 + 4
    Next
End Sub

Public Sub thread1f2()
    For i = 1001 To 1500
        DataGridView1.Item("PD", i).Value = i + 4452
        DataGridView1.Item("PDP", i).Value = i + 34
        DataGridView1.Item("TPD", i).Value = i + 123
        DataGridView1.Item("TPDP", i).Value = i + 44
    Next
End Sub

Public Sub thread1f3()
    For i = 1501 To 2000
        DataGridView1.Item("PD", i).Value = i + 423
        DataGridView1.Item("PDP", i).Value = i + 423
        DataGridView1.Item("TPD", i).Value = i + 423
        DataGridView1.Item("TPDP", i).Value = i + 423 / 2
    Next

End Sub

‘//////////////////////////////////////////////////////////////////////////////////////////

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    thread0 = New System.Threading.Thread(AddressOf thread1f0)
    thread0.Start()

    thread1 = New System.Threading.Thread(AddressOf thread1f1)
    thread1.Start()

    thread2 = New System.Threading.Thread(AddressOf thread1f2)
    thread2.Start()

    thread3 = New System.Threading.Thread(AddressOf thread1f3)
    thread3.Start()
End Sub



Public Sub GetData(ByVal selectCommand As String)

    Try
        Dim connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFileName
        Me.dataAdapter = New OleDbDataAdapter(selectCommand, connectionString)
        Dim commandBuilder As New OleDbCommandBuilder(Me.dataAdapter)
        Dim table As New DataTable()
        table.Locale = System.Globalization.CultureInfo.InvariantCulture
        Me.dataAdapter.Fill(table)
        Me.bindingSource1.DataSource = table
        Me.DataGridView1.AutoResizeColumns( _
            DataGridViewAutoSizeColumnsMode.ColumnHeader)
    Catch ex As OleDbException
        MessageBox.Show(ex.Message)
    End Try

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:01:04+00:00Added an answer on June 9, 2026 at 1:01 pm

    Since your DataGridView control is using a DataTable as a DataSource, you need to update the DataTable, not the DataGridView control.

    The threads don’t seem necessary. Just use one BackgroundWorker thread to not freeze the GUI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello ever one I want to ask a question about file opening.I want to
Hello I want to know how to highlight all Words that is inputted in
Hello guys that is not normal :) !! foo.php <?php if (isset($_POST['data'])) $stringData =
Hello I just publish an app that require a database with Sql Server 2008
Hello, I want to put custom status bar in notification window of iphone. is
Hello all I am working on javascript jquery and svg.I want to ask a
hello friends i am trying to get a list of user id and want
Hello guys I need to pass a string array over to a setter that
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello fellow developers... just to make sure, I want to ask this question: How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.