Hallo Ng,
folgendes Stückchen Programm:
try
stmFile = System.IO.File.Open(txt_Convert.Text,
IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
objCRC = New DesktopDll.FileOp.CRC32
intResult = objCRC.GetCrc32(stmFile)
stmFile.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly)
End Try
Meine Frage:
Kann ich irgendwie darauf Einfluss nehmen, wie lange es dauert, bis die
Exception geworfen wird, dass die Datei nicht existiert? Einen wie auch
immer gearteten Timeout zu verringern....momentan benötigt Windows ca 8
Sekunden - das ist ein bissl lang....
Ich bin mir bewusst, dass ich den Code dahingehend optimieren kann, dass ich
per FileInfo vorher auf die Existenz abprüfen kann. Deswegen mehr so die
grundsätzlich Frage, ob ich an der Stelle eine Chance habe, die in etwa
folgendes möglich macht:
"Schau 0,5sek, ob du die Datei findest und wenn nicht, dann wirf die
Exception"
Das würde mir das Leben auch an anderen Stellen evtl etwas vereinfachen :)
Gruß
Thiemo 2 1654
sorry for hitting wrong group...thus should haven gone into the german
one...arrgs :(
"Thiemo Ripper" <th****@discussions.microsoft.com> schrieb im Newsbeitrag
news:uL**************@TK2MSFTNGP15.phx.gbl... Hallo Ng,
folgendes Stückchen Programm: try stmFile = System.IO.File.Open(txt_Convert.Text, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read) objCRC = New DesktopDll.FileOp.CRC32 intResult = objCRC.GetCrc32(stmFile) stmFile.Close() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly) End Try
Meine Frage: Kann ich irgendwie darauf Einfluss nehmen, wie lange es dauert, bis die Exception geworfen wird, dass die Datei nicht existiert? Einen wie auch immer gearteten Timeout zu verringern....momentan benötigt Windows ca 8 Sekunden - das ist ein bissl lang....
Ich bin mir bewusst, dass ich den Code dahingehend optimieren kann, dass ich per FileInfo vorher auf die Existenz abprüfen kann. Deswegen mehr so die grundsätzlich Frage, ob ich an der Stelle eine Chance habe, die in etwa folgendes möglich macht: "Schau 0,5sek, ob du die Datei findest und wenn nicht, dann wirf die Exception"
Das würde mir das Leben auch an anderen Stellen evtl etwas vereinfachen :)
Gruß Thiemo
as far as i know of you can`t set the time when the exception will be thrown
well indeed i would first check if the file exists
system.IO.File.Exists ()
regards
Michel Posseth [MCP]
"Thiemo Ripper" <th****@discussions.microsoft.com> wrote in message
news:uL**************@TK2MSFTNGP15.phx.gbl... Hallo Ng,
folgendes Stückchen Programm: try stmFile = System.IO.File.Open(txt_Convert.Text, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read) objCRC = New DesktopDll.FileOp.CRC32 intResult = objCRC.GetCrc32(stmFile) stmFile.Close() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly) End Try
Meine Frage: Kann ich irgendwie darauf Einfluss nehmen, wie lange es dauert, bis die Exception geworfen wird, dass die Datei nicht existiert? Einen wie auch immer gearteten Timeout zu verringern....momentan benötigt Windows ca 8 Sekunden - das ist ein bissl lang....
Ich bin mir bewusst, dass ich den Code dahingehend optimieren kann, dass ich per FileInfo vorher auf die Existenz abprüfen kann. Deswegen mehr so die grundsätzlich Frage, ob ich an der Stelle eine Chance habe, die in etwa folgendes möglich macht: "Schau 0,5sek, ob du die Datei findest und wenn nicht, dann wirf die Exception"
Das würde mir das Leben auch an anderen Stellen evtl etwas vereinfachen :)
Gruß Thiemo This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ecowalker |
last post by:
Hello,
I've try the following code in the ASPX and it throw a Security
Exception in the runtime, but I've try to run on my colleagues machine
without any problem.
I am using XP Pro and IIS5.1...
|
by: Andrew Dowding |
last post by:
Hi Everybody,
I have been looking at problems with my Windows Forms C# application
and it's little Jet 4 (Access) database for the last few days. The
Windows Forms app implements a facade and...
|
by: Diego F. |
last post by:
I think I'll never come across that error. It happens when running code from
a DLL that tries to write to disk. I added permissions in the project
folder, the wwwroot and in IIS to NETWORK_SERVICE...
|
by: Carl Gilbert |
last post by:
Hi
I am trying to get an online gallery to work (www.ngallery.org). I have
managed to get it all working on my local host but I can not get it to work
on my web space.
The site can be found...
|
by: Peter Aitken |
last post by:
It seems that some classes have their own exception handling built in. For
example if I try to use FileStream to open a file that does not exist, my
Try...Catch block seems to be ignored and...
|
by: Jennifer |
last post by:
On an ASP page I've got some code that is supposed to "export" data in
a grid to an Excel file. What I'm doing is writing all the data to a
text file, separating the fields by commas. Then I'll...
|
by: Ankit Aneja |
last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the
Application Block
I configured the DAAB using the Enterprise Library Configuration
now this is the error which is coming
...
|
by: KaNos |
last post by:
Hello world,
I've made a webservice (c# v2) to install in a server IIS 6 on a Windows
2000 last SP. We can use the webservice in local, throw the pages wich
present the methods, with a windows...
|
by: cathy25 |
last post by:
Hi,
I am using the following code to read a file.
DirectoryInfo dir = new DirectoryInfo(@"C:\");
try
{
if (dir.Exists)
{
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |