生成时候只要不移动程序,程序就正常,移动一下就显示未响应。textbox1.text一直显示不了
Public Sub creatxml()
For i As Integer = 0 To arrayfile(arrayfile.Count - 1)
getlist(arrayfile(i), arraypath(i))
Next
End sub
Public Sub getlist(ByVal xmlstr As String, ByVal savestr As String)
Dim xmldoc As New XmlDocument
Dim root As XmlElement = xmldoc.CreateElement("contents")
Dim child1 As XmlElement = xmldoc.CreateElement("docpath")
xmldoc.AppendChild(root)
root.AppendChild(child1)
For Each foundFile As String In My.Computer.FileSystem.GetFiles(xmlstr, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
If foundFile.ToUpper.EndsWith(".JPG") OrElse foundFile.ToUpper.EndsWith(".PNG") Then
Dim child2 As XmlElement = xmldoc.CreateElement("pathstr")
child2.InnerText = array(m).ToString
child1.AppendChild(child2)
End If
Next
xmldoc.Save(savestr)
textbox1.text=savestr
End sub
------解决方案--------------------
可以把处理代码放到backgroudworker运行
------解决方案--------------------
app.doeven
------解决方案--------------------
使用线程处理,界面就不会假死
------解决方案--------------------
如果是save方法慢,把save方法放到线程里异步执行
如果是循环慢,在循环里加上
Application.DoEvents()
------解决方案--------------------
使用线程进行异步处理,页面线程就不会死