以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求助 同时添加多个图片  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=101512)

--  作者:jackyfashion
--  发布时间:2017/6/1 21:14:00
--  求助 同时添加多个图片

您好!

老师:

Dim tt As Table = Tables("yywrkhtc")
Dim lt17 = tt(17)("khtc") & "\\"
Dim dlg As New OpenFileDialog
\'Dim piv As WinForm.PictureViewer = e.Form.Controls("图片")
Dim pth As String = lt17
dlg.Filter= "图形文件|*.*"
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
For Each file As String In dlg.FileNames
Tables("表A").AddNew
Dim r As Row = Tables("表A").Current
r("图片") = r("编号") & ".jpg"
FileSys.CopyFile(dlg.FileName,pth & r("ltsu"),True)
Next
End If

上边的代码,就是多选图片有几个,复制在文件件是有几个,但都是同一个图片(第一 个图片),

请老师指点!!!

谢谢!!!

[此贴子已经被作者于2017/6/1 21:14:52编辑过]

--  作者:有点色
--  发布时间:2017/6/1 22:22:00
--  
Dim tt As Table = Tables("yywrkhtc")
Dim lt17 = tt(17)("khtc") & "\\"
Dim dlg As New OpenFileDialog
\'Dim piv As WinForm.PictureViewer = e.Form.Controls("图片")
Dim pth As String = lt17
dlg.Filter= "图形文件|*.*"
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
    For Each file As String In dlg.FileNames
        Tables("表A").AddNew
        Dim r As Row = Tables("表A").Current
        r("图片") = r("编号") & ".jpg"
        FileSys.CopyFile(file,pth & r("ltsu"),True)
    Next
End If

--  作者:jackyfashion
--  发布时间:2017/6/1 22:48:00
--  

谢谢老师!

可以了,谢谢!