掌握了上面的帮助,你会发现其实增加文件很简单:
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "图形文件|*.bmp;*.jpg;*.gif" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim dr As DataRow = Tables("表A").Current.DataRow
Dim lst As List(of String) = dr.Lines("文件") '获取文件集合
lst.Add(Filesys.GetName(dlg.FileName)) '给集合增加一个文件
dr.Lines("文件") = lst '将新的集合赋值给文件列
If dlg.FileName.ToLower.StartsWith((ProjectPath & "Attachments").ToLower) = False Then '如果文件不在Attachments目录
FileSys.CopyFile(dlg.FileName,ProjectPath & "Attachments\" & Filesys.GetName(dlg.FileName),True) '那么复制到Attachments目录
End If
End If