我有一个带有 abutton
和 a的 windows 窗体datagridview
。当我选择button
一个线程启动时,它会做一些事情并最终填充我的datagridview
. 问题是datagridview
没有填充。
我究竟做错了什么?
我的代码:
Private MyCreateStructureFromSampleXMLTread As Thread
Private Sub ButtonCreateStructureFromSampleXML_Click(sender As Object, e As EventArgs) Handles ButtonCreateStructureFromSampleXML.Click
Me.Cursor = Cursors.WaitCursor
MyCreateStructureFromSampleXMLTread = New Thread(AddressOf ModuleXML_MESSAGE_STRUCTURE.CreateStructureFromSampleXML)
MyCreateStructureFromSampleXMLTread.IsBackground = True
MyCreateStructureFromSampleXMLTread.SetApartmentState(ApartmentState.STA)
MyCreateStructureFromSampleXMLTread.Start()
Me.Cursor = Cursors.Default
End Sub
穿线:
Friend Sub CreateStructureFromSampleXML()
FormUTool.Cursor = Cursors.WaitCursor
Try
If ModuleFileHandling.OpenFile(Application.StartupPath, "Select XML File", ".xml", "XML File (*.xml)|*.xml") = True Then
ParseXMLFile(PublicUToolVariable.MyOpenedFile)
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
ModuleXML_MESSAGE_STRUCTURE.AlignElementPaths(PublicUToolVariable.MyAccessConnection)
ModuleXML_MESSAGE_STRUCTURE.XML_MESSAGE_STRUCTUREFillDataGridView(PublicUToolVariable.MyAccessConnection)
FormUTool.Cursor = Cursors.Default
End Sub