Click here to Skip to main content
15,888,182 members
Home / Discussions / C#
   

C#

 
QuestionHow to get selected value of a listbox control which are dynamically binded by the database Pin
veereshIndia3-Sep-07 19:02
veereshIndia3-Sep-07 19:02 
AnswerRe: How to get selected value of a listbox control which are dynamically binded by the database Pin
Sonia Gupta3-Sep-07 19:46
Sonia Gupta3-Sep-07 19:46 
Questionpie charts and ba charts in window application using the crystal reports Pin
Sonia Gupta3-Sep-07 18:34
Sonia Gupta3-Sep-07 18:34 
QuestionEnterprise Library Pin
sangramkp3-Sep-07 18:12
sangramkp3-Sep-07 18:12 
QuestionNew to C# Pin
sa_runner3-Sep-07 18:11
sa_runner3-Sep-07 18:11 
AnswerRe: New to C# Pin
originSH3-Sep-07 22:25
originSH3-Sep-07 22:25 
AnswerRe: New to C# Pin
Thomas Stockwell4-Sep-07 6:07
professionalThomas Stockwell4-Sep-07 6:07 
QuestionThe process cannot access the file because it is being used by another process. Pin
toink toink3-Sep-07 17:36
toink toink3-Sep-07 17:36 
I have these line of codes :

try
{
string fromDir = file.Substring(0, file.LastIndexOf("\\"));
System.IO.Directory.SetCurrentDirectory(fromDir);
if (!File.Exists(fileToZip))
{
throw new FileNotFoundException("The specified file " + fileToZip + " could not be found. Zipping aborderd");
}

FileStream StreamToZip = new FileStream(fileToZip, FileMode.Open, FileAccess.ReadWrite);
FileStream ZipFile = File.Create(zippedFile);
ZipOutputStream ZipStream = new ZipOutputStream(ZipFile);

ZipEntry ZipEntry = new ZipEntry(fileToZip.Substring(fileToZip.LastIndexOf("\\") + 1));
ZipStream.PutNextEntry(ZipEntry);

ZipStream.SetLevel(CompressionLevel);
if (password != null && !password.Equals(string.Empty))
ZipStream.Password = password;
byte[] buffer = new byte[BlockSize];
System.Int32 size = StreamToZip.Read(buffer, 0, buffer.Length);
ZipStream.Write(buffer, 0, size);
try
{
while (size < StreamToZip.Length)
{
int sizeRead = StreamToZip.Read(buffer, 0, buffer.Length);
ZipStream.Write(buffer, 0, sizeRead);
size += sizeRead;
}
}
catch (System.Exception ex)
{
throw ex;
}
ZipStream.Finish();
ZipStream.Close();
StreamToZip.Close();
}
catch (Exception ex)
{
throw ex;
}


The error occurs on this line

FileStream ZipFile = File.Create(zippedFile);

how am i going to resolve it? thanks
AnswerRe: The process cannot access the file because it is being used by another process. Pin
originSH3-Sep-07 22:29
originSH3-Sep-07 22:29 
QuestionSQL Connection String Problem Pin
Xmen Real 3-Sep-07 16:56
professional Xmen Real 3-Sep-07 16:56 
AnswerRe: SQL Connection String Problem Pin
Michael Sync3-Sep-07 17:33
Michael Sync3-Sep-07 17:33 
Questionsql checkedlistbox and insert statement Pin
falles013-Sep-07 16:53
falles013-Sep-07 16:53 
QuestionDrawing on controls Pin
udikantz3-Sep-07 16:45
udikantz3-Sep-07 16:45 
AnswerRe: Drawing on controls Pin
rah_sin3-Sep-07 22:23
professionalrah_sin3-Sep-07 22:23 
GeneralRe: Drawing on controls Pin
udikantz10-Sep-07 14:50
udikantz10-Sep-07 14:50 
QuestionInterface does not alter class, or does it? [modified] Pin
mizitras3-Sep-07 15:09
mizitras3-Sep-07 15:09 
AnswerRe: Interface does not alter class, or does it? Pin
PIEBALDconsult3-Sep-07 17:11
mvePIEBALDconsult3-Sep-07 17:11 
GeneralRe: Interface does not alter class, or does it? Pin
Urs Enzler3-Sep-07 22:31
Urs Enzler3-Sep-07 22:31 
GeneralRe: Interface does not alter class, or does it? Pin
PIEBALDconsult4-Sep-07 4:59
mvePIEBALDconsult4-Sep-07 4:59 
GeneralRe: Interface does not alter class, or does it? Pin
Urs Enzler4-Sep-07 5:54
Urs Enzler4-Sep-07 5:54 
AnswerRe: Interface does not alter class, or does it? Pin
PIEBALDconsult4-Sep-07 5:03
mvePIEBALDconsult4-Sep-07 5:03 
AnswerRe: Interface does not alter class, or does it? [modified] Pin
Dave Kreskowiak4-Sep-07 5:56
mveDave Kreskowiak4-Sep-07 5:56 
GeneralRe: Interface does not alter class, or does it? Pin
mizitras5-Sep-07 17:06
mizitras5-Sep-07 17:06 
QuestionRound window and change the size and no more round Pin
AghaKhan3-Sep-07 14:44
AghaKhan3-Sep-07 14:44 
QuestionAdding onclick event to class Pin
DanB19833-Sep-07 10:04
DanB19833-Sep-07 10:04 

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.