Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I want to send email with multiple attachments in windows application using vb.net. i am using OpenFileDialog control. But i can select only 1 file from it, is there any wayaround, where users can select multiple files in one OpenFileDialog control or any other control in windows application.
Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 26-Jan-12 2:30am    
What have you done so far? Could you present some code sample?
--SA

Hi SAKryukov,
I have taken String attchfilename & an array attchfiles to store the colection of files. But in array i am getting only one file, although i have attached 2 files.


C#
Public Sub btnbrowse_Click(sender As System.Object, e As System.EventArgs) Handles btnbrowse1.Click
    OpenFileDialog1.ShowDialog()
    Dim attchfilename as String
    Dim attchfiles(0 To 1) As String
    attchfilename = txtattch1.Text + OpenFileDialog1.FileName.ToString() + ","
    attchfiles = attchfilename.Split(",")
End Sub
 
Share this answer
 
Comments
kiquenet.com 27-Feb-19 9:37am    
Redim attachfilename ?? in each Click ?
Hi Tanzy,

Slight modifications to your OpenFileDialog Code.

<pre lang="c#">
OpenFileDialog Obj = new OpenFileDialog();
Obj.Multiselect = true;
Obj.ShowDialog();
foreach (String item in Obj.FileNames)
{
MessageBox.Show(item);
}</pre>

This should do the trick :)
 
Share this answer
 
Comments
Tanzy123 26-Jan-12 6:34am    
Thanks Jyothikarthik_N,
[no name] 27-Jan-12 0:45am    
You're welcome...
Do mark it as answer, if it solved your purpose.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900