Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi,,,

How to get attached or selected files into a textbox using OpenFileDialog control...?

I tried this code..

FileAttachtxt.Text =openFileDialog1.SafeFileNames.ToString();



but returning an array...
Posted
Comments
Zoltán Zörgő 30-Mar-13 8:23am    
File into textbox? What do you want exactly? Please improve your question!
Of course it return an array, because it is the array of file names. Do a loop or whatever you want...
See MSDN: http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.safefilenames.aspx
PRAKASH_N 30-Mar-13 8:35am    
i want all selected filenames with extensions.
Zoltán Zörgő 30-Mar-13 8:40am    
There you have it in that array, but how do you intend to process them? Do you need them as a comma separated list or what?
PRAKASH_N 30-Mar-13 8:49am    
yes..i need with ';' separator
[no name] 30-Mar-13 9:00am    
Okay so do it. What is the problem exactly?

Try this:
C#
FileAttachtxt.Text =String.Join(";", openFileDialog1.SafeFileNames);

PS: if you don't reply to my comment, I wont be notified, so please use the page widgets in the appropriate way.
 
Share this answer
 
Comments
PRAKASH_N 30-Mar-13 14:04pm    
Thanks..... it works....

SpeedTest.png ; Untitled.png
Zoltán Zörgő 30-Mar-13 14:10pm    
Great. Than feel free to accept my answer.
PRAKASH_N 30-Mar-13 14:19pm    
can look into this:

http://www.codeproject.com/Questions/570053/bestpluswayplustoplussendplusbulkplusmailplusinplu
First of all, read this: OpenFileDialog (System.Windows.Forms)[^] than have a look at: C# OpenFileDialog Tutorial[^]
 
Share this answer
 

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