| | |
Server Files in Combobox ??
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
Hello fellow super coder people
i am rtying to list all the files in a certain directory (eg. "TestDir") in a combobox
That only downloads one file into the combobox ...
Any ideas ???
please help...
Regards and thanks...
i am rtying to list all the files in a certain directory (eg. "TestDir") in a combobox
C# Syntax (Toggle Plain Text)
try { m_ftp.Server = txtftpServerName.Text; m_ftp.Username = txtftpUserName.Text; m_ftp.Password = txtftpPassword.Text; m_ftp.Login(); string[] The_File = m_ftp.GetFileList("TestDir"); foreach (string FILE in The_File) { cboFindFile.Items.Add(FILE); Console.Write(FILE); } m_ftp.Close(); } catch(Exception EX) { MessageBox.Show("Files Not Downloaded"); }
That only downloads one file into the combobox ...
Any ideas ???
please help...
Regards and thanks...
Last edited by cVz; Jan 8th, 2009 at 6:11 am.
Delphi & C# programmer deluxe...
Ok i understand that , thank you very much ... i tested a few other ways, but for argument sake lets say i said
or
or even
/* Just keep in mind that the TCP is already connected so specifying just a directory works for Upload and delete */
It gives me the same problem , so could you maybe make my day worth wile and help me try something else ?
Even a total different approach is fine, i can adjust my code...
LizR - you rock , thanks for your help
C# Syntax (Toggle Plain Text)
string[] The_Files = m_ftp.GetFileList("/");
or
C# Syntax (Toggle Plain Text)
string[] The_Files = m_ftp.GetFileList("TestDir/");
or even
C# Syntax (Toggle Plain Text)
string[] The_Files = m_ftp.GetFileList("//TestDir/");
/* Just keep in mind that the TCP is already connected so specifying just a directory works for Upload and delete */
It gives me the same problem , so could you maybe make my day worth wile and help me try something else ?
Even a total different approach is fine, i can adjust my code...
LizR - you rock , thanks for your help
Delphi & C# programmer deluxe...
The directory contains about 5 zipped files , trust me i have been debugging ... hahaha, i guess this leaves me at phase one again, but rest asured, i never give up, i will post the working code soon, watch this space ... hehehe
The problem must be within the loop somewhere, thats why i think maybe doing a 'for' loop rather than a 'foreach' loop, because it does give me the first file in the dir, but there are about five .bak files that are zipped ... so lets say .zip files
Anyway , thanks for your attempt
The problem must be within the loop somewhere, thats why i think maybe doing a 'for' loop rather than a 'foreach' loop, because it does give me the first file in the dir, but there are about five .bak files that are zipped ... so lets say .zip files
Anyway , thanks for your attempt
Delphi & C# programmer deluxe...
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
no no, you're missing the point.
If the function you're calling only sends back the 1 file, then thats all it has to send. For loop and foreach wont make any difference.
if the array only has the 1 file, you cant change that
If the function you're calling only sends back the 1 file, then thats all it has to send. For loop and foreach wont make any difference.
if the array only has the 1 file, you cant change that
Last edited by LizR; Jan 8th, 2009 at 9:10 am.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Ok i think i know whats wrong here
i think that the files are not registering in the array - what you said
I dont even have a loop there but it works exactly the same ...
i think that the files are not registering in the array - what you said
C# Syntax (Toggle Plain Text)
private void FindFiles(object sender, EventArgs e) { try { m_ftp.Server = txtftpServerName.Text; m_ftp.Username = txtftpUserName.Text; m_ftp.Password = txtftpPassword.Text; m_ftp.Login(); m_ftp.ChangeDir(txtToDirectory.Text); string[] fi = m_ftp.GetFileList(); cboFindFile.Items.AddRange(fi); m_ftp.Close(); } catch(Exception EX) { MessageBox.Show("File Not Downloaded"); } }
I dont even have a loop there but it works exactly the same ...
Last edited by cVz; Jan 8th, 2009 at 9:30 am.
Delphi & C# programmer deluxe...
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
- problem in listing directories in list box (Java)
Other Threads in the C# Forum
- Previous Thread: add custom control to outlook toolbar in VSTO
- Next Thread: Null reference in array
| Thread Tools | Search this Thread |
.net access algorithm array asp.net bitmap box broadcast c# check checkbox client combobox control conversion csharp database datagrid datagridview dataset datetime dbconnection decryption degrees design developer draganddrop drawing encryption enum eventhandlers excel file firefox focus form format forms function gdi+ grantorrevokepermissionthroughc#.net hospitalmanagementsystem image input install interface java libraries list loop marshalbyrefobject math mouseclick movingimage mysql netcfsvcutil.exe numeric operator path photoshop php picturebox pixelinversion platform polynomial post programming properties radians read regex remote remoting richtextbox server sleep socket sql statistics string stringformatting study system.servicemodel table tcpclientchannel text textbox thread time timer update usb usercontrol validation visualstudio webbrowser winforms wpf wpfc# xml






