您好,我正在尝试使用我的列表框中的路径,但它出现错误
Dim items As New ListBox
'Getting the path of the selected file on opendialog'
For Each filename As String In OpenFileDialog1.FileNames
items.Items.Add(filename)
Next
For Each sourcepath As FileInfo In items.Items()
sourcepath.CopyTo(path)
Next发布于 2015-06-28 19:47:05
您已经在列表框中放置了字符串,因此当您循环这些项时,您将获得返回的字符串。如果您想要FileInfo对象,则必须从字符串创建它们:
For Each sourcepath As String In items.Items
Dim fileInfo = New FileInfo(sourcepath).CopyTo(path)
Nexthttps://stackoverflow.com/questions/31099285
复制相似问题