Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.NET / MS Access Threading Issue...

VB.NET / MS Access Threading Issue...

Scheduled Pinned Locked Moved Visual Basic
helptutorialcsharp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mayhem_rules
    wrote on last edited by
    #1

    I am running a procedure in a thread which is created on the click of a button. However, the process does not complete correctly. Please refer to the code below: Private Sub cmdProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdProcess.Click Try Dim tquery As Thread tquery = New Thread(AddressOf Me.GetData) tquery.Start() Catch ex As Exception MessageBox.Show(ex.Message, "Error In cmdProcess_Click", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Private Sub GetData() Try Dim field1, field2, op1, period1, value1 As String Dim m1, y1, tablename As String period1 = Trim(cmbPeriod.Text) m1 = Mid(Trim(period1), 5, 2) y1 = Mid(Trim(period1), 3, 2) tablename = "SSA" & m1 & y1 field1 = Trim(cmbField1.Text) value1 = Trim(cmbValue.Text) op1 = Trim(cmbOP1.Text) field2 = Trim(cmbField2.Text) str = "select " & Trim(op1) & "(" & Trim(field2) & ") from " & Trim(tablename) & " group by " & Trim(field1) & " order by " & Trim(field1) ipcon.Open() DA = New OleDbDataAdapter(str, ipcon) DS = New DataSet DA.Fill(DS, "qrec") ipcon.Close() DataGrid1.SetDataBinding(DS, "qrec") Catch ex As Exception MessageBox.Show(ex.Message, "Error In GetData", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub -- This code exits with the following error message 'Controls created on one thread cannot be parented to a control on a different thread' Please guide me how to resolve this issue. With Best Regards, Mayur

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups