Click here to Skip to main content
15,913,130 members
Home / Discussions / C#
   

C#

 
GeneralRe: Auto Calculate An Age Without Postback a Page Pin
Brady Kelly16-Nov-07 21:58
Brady Kelly16-Nov-07 21:58 
AnswerRe: Auto Calculate An Age Without Postback a Page Pin
Christian Graus16-Nov-07 22:01
protectorChristian Graus16-Nov-07 22:01 
Questiondisplay in a textbox contents from a .txt file [modified] Pin
new2pgrmg16-Nov-07 20:18
new2pgrmg16-Nov-07 20:18 
AnswerRe: display in a textbox contents from a .txt file Pin
Abhijit Jana16-Nov-07 20:31
professionalAbhijit Jana16-Nov-07 20:31 
AnswerRe: display in a textbox contents from a .txt file Pin
Abhijit Jana16-Nov-07 20:32
professionalAbhijit Jana16-Nov-07 20:32 
AnswerRe: display in a textbox contents from a .txt file Pin
Mircea Puiu16-Nov-07 20:51
Mircea Puiu16-Nov-07 20:51 
AnswerRe: display in a textbox contents from a .txt file Pin
Christian Graus16-Nov-07 22:52
protectorChristian Graus16-Nov-07 22:52 
QuestionThis is weird!!! Pin
kingletas16-Nov-07 18:56
kingletas16-Nov-07 18:56 
Why am i getting this exception...

System.TypeInitializationException was unhandled
Message="The type initializer for 'Client.Form1' threw an exception."
Source="Client"
TypeName="Client.Form1"
StackTrace:
at Client.Form1..ctor()
at Client.Program.Main() in C:\Documents and Settings\Luis\Desktop\Server\Client\Client\Program.cs:line 21
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

I added this code to it....

In a different class from the main form i have this:
// the try and catch were there already
try{....}// see the finally statement for more info
catch(....){....}// i just warned that all files in the given file will be deleted
//this is the newly added code
finally

{
//path points to a given folder,specify by the Administrator during runtime
//
foreach(string npath in Dfiles)
{
File.Delete(npath);
}

string[] files = Directory.GetFiles(@"C:\Backup", "*.lais");

foreach (string npath in files)
{
File.Copy(npath, path, true);

}

//this is the same i have in the try statement
Dfiles = Directory.GetFiles(@path,".lais");//just to make sure i have all the files now...
if(Dfiles>0){

foreach (string npath in Dfiles)
{
tempor = File.ReadAllBytes(Dfiles[i]);
ms = new MemoryStream(tempor, 0, tempor.Length);
crypto = new CryptoStream(ms, Algorythm.CreateDecryptor(), CryptoStreamMode.Read);

crypto.Read(tempor, 0, tempor.Length);

Images[i] = Image.FromStream(ms);

crypto.Close();
ms.Close();
}
}
}


plus... in the main form i added this:

private static Hook hook = new Hook();
//handle the keys
hook.KeyDown += new KeyEventHandler(hook_KeyDown);
hook.KeyPress += new KeyPressEventHandler(hook_KeyPress);
hook.KeyUp += new KeyEventHandler(hook_KeyUp);

//users are not allowed to do anything with the keyboard
void hook_KeyUp(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = false;

}

void hook_KeyDown(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = false;

}

void hook_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}

The hook class is fine, the project class worked fine with it... after i added the finally statement was when the exception came...

What i want is: "If before the application starts a file in the given folder has been modified/altered, a file has been renamed/deleted/created with the same extension" and causes a decripting error i would like that file to be deleted and inform of the deletion without stopping the application. Durin' Runtime i know how to restore files that have been altered/modified but before runtime is quite hard to me!

Please help...


Luis E Tineo S

AnswerRe: This is weird!!! Pin
mav.northwind16-Nov-07 21:33
mav.northwind16-Nov-07 21:33 
Questionreg: Go to line number in text file Pin
Satish - Developer16-Nov-07 18:09
Satish - Developer16-Nov-07 18:09 
AnswerRe: reg: Go to line number in text file Pin
Christian Graus16-Nov-07 18:41
protectorChristian Graus16-Nov-07 18:41 
GeneralRe: reg: Go to line number in text file Pin
Satish - Developer16-Nov-07 18:51
Satish - Developer16-Nov-07 18:51 
GeneralRe: reg: Go to line number in text file Pin
Christian Graus16-Nov-07 22:54
protectorChristian Graus16-Nov-07 22:54 
AnswerRe: reg: Go to line number in text file Pin
Sun Rays16-Nov-07 18:45
Sun Rays16-Nov-07 18:45 
GeneralRe: reg: Go to line number in text file Pin
Satish - Developer16-Nov-07 18:54
Satish - Developer16-Nov-07 18:54 
AnswerRe: reg: Go to line number in text file Pin
Guffa16-Nov-07 23:39
Guffa16-Nov-07 23:39 
QuestionValues Form Radio Button In UserContol Pin
MuraleeKrishnan16-Nov-07 17:37
MuraleeKrishnan16-Nov-07 17:37 
AnswerRe: Values Form Radio Button In UserContol Pin
SABhatti16-Nov-07 17:47
SABhatti16-Nov-07 17:47 
QuestionHow to copy data table to arraylist ...? Pin
Pankaj - Joshi16-Nov-07 16:12
Pankaj - Joshi16-Nov-07 16:12 
AnswerRe: How to copy data table to arraylist ...? Pin
SABhatti16-Nov-07 17:54
SABhatti16-Nov-07 17:54 
GeneralRe: How to copy data table to arraylist ...? Pin
Pankaj - Joshi16-Nov-07 18:49
Pankaj - Joshi16-Nov-07 18:49 
GeneralRe: How to copy data table to arraylist ...? Pin
SABhatti16-Nov-07 19:02
SABhatti16-Nov-07 19:02 
GeneralRe: This not solved my problem yet... Pin
Pankaj - Joshi18-Nov-07 16:08
Pankaj - Joshi18-Nov-07 16:08 
GeneralRe: This not solved my problem yet... Pin
SABhatti18-Nov-07 17:03
SABhatti18-Nov-07 17:03 
GeneralRe: How to copy data table to arraylist ...? Pin
Pankaj - Joshi18-Nov-07 16:41
Pankaj - Joshi18-Nov-07 16:41 

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.