Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

daniel abcde

@daniel abcde
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to interrupt a method in c#?
    D daniel abcde

    hi i have come accross a problem that after the process completed i cannot start the copy process again once it have completed. It complains "The object have been disposed", My question is how can i check if the bw have been stoped and i can start another bw(oR create a new bw)? I used the GUI to make the bw, it generates this private BackgroundWorker bw; ... this.bw = new System.ComponentModel.BackgroundWorker(); ... this.bw.DoWork += new System.ComponentModel.DoWorkEventHandler(this.bw_DoWork); this.bw.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.bw_RunWorkerCompleted); ..... public static void copyDirectory(string Src, string Dst) // http://www.codeproject.com/KB/files/copydirectoriesrecursive.aspx { String[] Files; fmCopying.StartPosition.Equals("Center"); if (Dst[Dst.Length - 1] != Path.DirectorySeparatorChar) Dst += Path.DirectorySeparatorChar; if (!Directory.Exists(Dst)) Directory.CreateDirectory(Dst); Files = Directory.GetFileSystemEntries(Src); /* fmCopying.pBar1.Visible = true; // Set Minimum to 1 to represent the first file being copied. fmCopying.pBar1.Minimum = 1; // Set Maximum to the total number of files to copy. fmCopying.pBar1.Maximum = Files.Length; // Set the initial value of the ProgressBar. fmCopying.pBar1.Value = 2; // Set the Step property to a value of 1 to represent each file being copied. fmCopying.pBar1.Step = 1; */ foreach (string Element in Files) { fmCopying.Refresh(); // Sub directories if (Directory.Exists(Element)){ System.Threading.Thread.Sleep(1000); copyDirectory(Element, Dst + Path.GetFileName(Element)); fmCopying.Refresh(); fmCopying.lblCopying.Text =Element; fmCopying.lblCopying2.Text = Dst + Path.GetFileName(Element); fmCopying.Refresh(); } // Files in directory else { System.Threading.Thread.Sleep(1000); File.Copy(Element, Ds

    C# csharp data-structures help tutorial question

  • How to interrupt a method in c#?
    D daniel abcde

    many thanks, Luc. I am now rewriting the Copy form and add Thread method to it, so when it starts it will open a new thread and start the copy method. But i don't quite get how to get Control.InvokeRequired and Control.Invoke works, can you please give a bit example or a bit explainlation of them? many thanks again! daniel

    C# csharp data-structures help tutorial question

  • Validate user permissions
    D daniel abcde

    perhaps using LDAP ? My program can allow AD users to change their password by their own. I'm not sure does this works in your case. You can try.

    C# csharp question announcement windows-admin security

  • How to interrupt a method in c#?
    D daniel abcde

    If i click on the stop button the window will freeze and the copy process don't stop.. My though in the code maynot be the best way of doing it, any ideas are welcome, many thanks for your help :)

    C# csharp data-structures help tutorial question

  • How to interrupt a method in c#?
    D daniel abcde

    Hi, i'm writing a program about copy files from one place to other place. When the copy process start, it will shows up a form and tells user what file are being copied and there is a button to allow the user to stop the process. My problem is i cannot make the "stop" button works.The program code is like this: ======Copy Form====== private void StopButton_Click(object sender, EventArgs e) { frmTest.Stopcopying = true; return; } =======Main form(frmtest) ======================== .... public static bool Stopcopying = false; ... public static void copyDirectory(string Src, string Dst) { String[] Files; fmCopying.StartPosition.Equals("Center"); if (Dst[Dst.Length - 1] != Path.DirectorySeparatorChar) Dst += Path.DirectorySeparatorChar; if (!Directory.Exists(Dst)) Directory.CreateDirectory(Dst); Files = Directory.GetFileSystemEntries(Src); // int[] result = Array.FindAll(Files, delegate(int i){} frmCopying fmCopying1 = new frmCopying(); fmCopying1.Show(); foreach (string Element in Files) { fmCopying1.Refresh(); // Sub directories if (Directory.Exists(Element)){ if (frmTest.Stopcopying == true) { fmCopying1.Close(); return; } copyDirectory(Element, Dst + Path.GetFileName(Element)); fmCopying1.Refresh(); fmCopying1.lblCopying.Text =Element; fmCopying1.lblCopying2.Text = Dst + Path.GetFileName(Element); fmCopying1.Refresh(); } // Files in directory else { if (frmTest.Stopcopying == true) { fmCopying1.Close(); return; } File.Copy(Element, Dst + Path.GetFileName(Element), true); fmCopying1.Refresh(); fmCopying1.lblCopying.Text =Element; fmCopying1.lblCopying

    C# csharp data-structures help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups