Click here to Skip to main content
15,916,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: C#, How to check an object to see if it is a numeric value? Pin
Christian Graus7-Apr-08 19:15
protectorChristian Graus7-Apr-08 19:15 
GeneralRe: C#, How to check an object to see if it is a numeric value? Pin
Jeeva Jose7-Apr-08 20:14
Jeeva Jose7-Apr-08 20:14 
GeneralRe: C#, How to check an object to see if it is a numeric value? Pin
Christian Graus7-Apr-08 20:19
protectorChristian Graus7-Apr-08 20:19 
GeneralRe: C#, How to check an object to see if it is a numeric value? Pin
Mircea Puiu7-Apr-08 21:33
Mircea Puiu7-Apr-08 21:33 
GeneralRe: C#, How to check an object to see if it is a numeric value? Pin
blackjack21507-Apr-08 23:51
blackjack21507-Apr-08 23:51 
GeneralRe: C#, How to check an object to see if it is a numeric value? Pin
Mircea Puiu8-Apr-08 21:19
Mircea Puiu8-Apr-08 21:19 
GeneralWell, there is a simpler way... Pin
Anthony Mushrow7-Apr-08 21:59
professionalAnthony Mushrow7-Apr-08 21:59 
QuestionHow to interrupt a method in c#? Pin
daniel abcde7-Apr-08 16:17
daniel abcde7-Apr-08 16:17 
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.lblCopying2.Text = Dst + Path.GetFileName(Element);
fmCopying1.Refresh();


}

}


fmCopying1.Close();


}



....


try
{



if (frmTest.Stopcopying == true) throw null;


copyDirectory(@path, @mapto);





} catch (Exception err)
{
{

string errrr = "Error: " + err.Message;
MessageBox.Show(this, errrr, "", MessageBoxButtons.OK, MessageBoxIcon.Error);


}
}
AnswerRe: How to interrupt a method in c#? Pin
daniel abcde7-Apr-08 16:21
daniel abcde7-Apr-08 16:21 
GeneralRe: How to interrupt a method in c#? Pin
Luc Pattyn7-Apr-08 17:21
sitebuilderLuc Pattyn7-Apr-08 17:21 
GeneralRe: How to interrupt a method in c#? Pin
daniel abcde7-Apr-08 21:30
daniel abcde7-Apr-08 21:30 
GeneralRe: How to interrupt a method in c#? Pin
Mircea Puiu7-Apr-08 21:55
Mircea Puiu7-Apr-08 21:55 
GeneralRe: How to interrupt a method in c#? Pin
scott_hackett9-Apr-08 2:53
scott_hackett9-Apr-08 2:53 
GeneralRe: How to interrupt a method in c#? Pin
Mircea Puiu10-Apr-08 21:29
Mircea Puiu10-Apr-08 21:29 
GeneralRe: How to interrupt a method in c#? Pin
daniel abcde14-Apr-08 0:04
daniel abcde14-Apr-08 0:04 
GeneralRe: How to interrupt a method in c#? Pin
Mircea Puiu14-Apr-08 23:27
Mircea Puiu14-Apr-08 23:27 
QuestionValidate user permissions Pin
Thedan7-Apr-08 15:40
Thedan7-Apr-08 15:40 
GeneralRe: Validate user permissions Pin
daniel abcde7-Apr-08 17:08
daniel abcde7-Apr-08 17:08 
QuestionAppDomain with System.Reflection.Assembly? Pin
Daniel Grondin7-Apr-08 15:31
Daniel Grondin7-Apr-08 15:31 
AnswerRe: AppDomain with System.Reflection.Assembly? Pin
Luc Pattyn7-Apr-08 15:36
sitebuilderLuc Pattyn7-Apr-08 15:36 
Generalproblem with HttpRequest.QueryString Pin
dfn7-Apr-08 12:44
dfn7-Apr-08 12:44 
GeneralRe: problem with HttpRequest.QueryString Pin
Christian Graus7-Apr-08 12:54
protectorChristian Graus7-Apr-08 12:54 
GeneralRe: problem with HttpRequest.QueryString Pin
Guffa7-Apr-08 13:59
Guffa7-Apr-08 13:59 
GeneralOpening files in a secure location Pin
RussBus7-Apr-08 11:40
RussBus7-Apr-08 11:40 
GeneralRe: Opening files in a secure location Pin
Christian Graus7-Apr-08 11:48
protectorChristian Graus7-Apr-08 11:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.