Hello, I have a problem with the progressbar in the following code: FtpClient ftp = new FtpClient("ftpadres", "user", "password",ttl,21); try { ftp.Login(); } catch (Exception ex) { MessageBox.Show(ex.Message); } ftp.ChangeDir("vrbo"); string fullPath = txtLoggedInSource.Text; string[] dir = fullPath.Split(new Char[] { '\\' }); int length = dir.Length; string directory = dir[length - 1]; ftp.MakeDir(bedrijfid + "_" + directory + "_" + timestamp); ftp.ChangeDir(bedrijfid + "_" + directory + "_" + timestamp); DirectoryInfo dir2 = new DirectoryInfo(txtLoggedInSource.Text); FileInfo[] files = dir2.GetFiles(); int filecount = files.Length; pbStatus.TabIndex = 0; pbStatus.Maximum = filecount; pbStatus.Minimum = 1; pbStatus.Step = 1; /* THIS WORKS PERFECT !!! for (int i = pbStatus.Minimum; i <= pbStatus.Maximum; i++) { pbStatus.PerformStep(); } * */ // HERE THE PROGRESSBAR DOESNT MOVE foreach (FileInfo f in files) { ftp.Upload(txtLoggedInSource.Text + "\\" + f.Name); pbStatus.PerformStep(); } label1.Text = "All files are upload successfully"; ftp.Close(); Can someone please help me why it doesn't work with upload Thx wistiti 5
wistiti5
Posts
-
progressbar problem -
Directory listingHello, I'm building an upload tool in c# but I only want to show de directories where the user has access to from the computer he is sitting on. I made a script that lists al the directories in a treeview, but it gives an error when it comes to a directory where the user had no access to. (ex. c:/documents and setting/administrator) Here a sample of my script private void FillDirectoryTree(TreeView tvw) { tvw.Nodes.Clear(); string[] strDrives = Environment.GetLogicalDrives(); foreach (string rootDirName in strDrives) { MessageBox.Show(rootDirName); if(rootDirName == "C:\\") { try { DirectoryInfo dir = new DirectoryInfo(rootDirName); dir.GetDirectories(); TreeNode ndRoot = new TreeNode(rootDirName); tvw.Nodes.Add(ndRoot); GetSubDirectoryNodes(ndRoot, ndRoot.Text, 1); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } Application.DoEvents(); } private void GetSubDirectoryNodes(TreeNode parentNode, string fullName, int level) { DirectoryInfo dir = new DirectoryInfo(fullName); DirectoryInfo[] dirSubs = dir.GetDirectories(); foreach (DirectoryInfo dirSub in dirSubs) { if ((dirSub.Attributes & FileAttributes.Hidden) != 0) { continue; } TreeNode subNode = new TreeNode(dirSub.Name); parentNode.Nodes.Add(subNode); if (level < MaxLevel) { GetSubDirectoryNodes(subNode, dirSub.FullName, level + 1); } } } private void tvDestFiles_AfterSelect(object sender, TreeViewEventArgs e) { txtTargetDir.Text = tvDestFiles.SelectedNode.FullPath; } private void btnUploadFiles_Click(object sender, EventArgs e) { List fileList = GetFileList(); foreach (FileInfo file in fileList) {
-
Connect to mysql using ByteFXThat was indeed the problem Thx wistiti 5
-
Connect to mysql using ByteFXHello, I've a problem connecting to a mysql Database. My program gives an error when i try to use using ByteFX.Data.MySqlClient; It gives this error with this code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using ByteFX.Data.MySqlClient; namespace UploadBatches { public partial class Form1 : Form { public Form1() { InitializeComponent(); } } } Error 1 The type or namespace name 'ByteFX' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\wvsighem\My Documents\Visual Studio 2005\Projects\UploadBatches\UploadBatches\Form1.cs 9 7 UploadBatches Can someone help me please Thx wistiti 5
-
Update form after queryHello, I have problem with updating my form after I've executed an update or insert query. How can I refresh my windows form in c#. Thx wistiti 5
-
insert sqlAnd how kan I solve this problem? thx wistiti 5
-
insert sqlI don't get an error message, that's the problem. I don't really understand what you mean with quickwatch, but if you mean what the output is at the end it gives: QUERY: bla bla inserted When I do this query directly with sql in the database it there is no problem. Regards William wistiti 5
-
insert sqlHello, I have a problem with inserting into a table. I can read from it, but no updates or inserts. This is the code i wrote: string connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Planning.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; string queryString = "INSERT INTO registratie(userid,clientid,taskid,unitid,date,start,stop,description) " + "VALUES(2,1,1,1,GETDATE(),'08:08','09:00','bla bla bal ...') "; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand(queryString, connection); try { connection.Open(); } catch (Exception ex) { MessageBox.Show(ex.Message); } try { int test = command.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { MessageBox.Show("QUERY: " + queryString + "\n inserted !!!"); connection.Close(); } Can someone please help me? thx wistiti 5