petermeachem
Programmer
I am using the following code to drag attachments to a form in the dragdrop event
It works very well, but users want to drag several files at once. I can't find any way to do that. Can anyone help?
Code:
Dim memoryStream As System.IO.MemoryStream = e.Data.GetData("FileGroupDescriptor")
memoryStream.Seek(76, IO.SeekOrigin.Begin)
Dim fileName As Byte() = New Byte(256) {}
'return the file name in the fileName variable
MemoryStream.Read(fileName, 0, 256)
Dim encoding As System.Text.Encoding = System.Text.Encoding.ASCII
'convert to byte arry to string
Dim strFileName As String = encoding.GetString(fileName)
'trim the strFileName to get the correct file name
strFileName = strFileName.TrimEnd("")
MemoryStream = e.Data.GetData("FileContents")
'write the file content to a file under the same path of the exe file.
Dim fs As New IO.FileStream(strFileName, IO.FileMode.Create)
MemoryStream.WriteTo(fs)
fs.Close()
c = strFileName