Hello,
I am running some code every 10 seconds to copy a file from a DOS server
over a Lantastic network. The problem is that when the DOS server is
restarted (it has to some times), my program crashes and reboots Windows. My
VB.Net Program is running on a Windows XP system using Lantastic 8.0 to
access the DOS server. How can I write the code so that if the DOS server
that the file is being copied from goes down, my VB.Net program continues to
run without crashing? Code is running in a timer control tick event and is
included below.
=========
Try
If File.Exists("\\Server1\Files\Data1.dbf") Then
Try
File.Copy(("\\Server1\Files\Data1.dbf",
"C:\Data\tblData.dbf", True)
Catch
'Do Nothing
End Try
End If
Catch
'Do Nothing
End Try 9 1412
Sarah,
The least thing you can do is changing in your code this
\\\
If File.Exists("\\Server1\Files\Data1.dbf") Then
Try
File.Copy(("\\Server1\Files\Data1.dbf",
"C:\Data\tblData.dbf", True)
Catch ex as exception
Messagebox.show(ex.tostring)
End Try
Else
messagebox.show("file does not exist)
End if
///
Making empty catch blocks is the worst thing you can do.
I hope this helps?
Cor The least thing you can do is changing in your code this
\\\ If File.Exists("\\Server1\Files\Data1.dbf") Then Try File.Copy(("\\Server1\Files\Data1.dbf", "C:\Data\tblData.dbf", True) Catch ex as exception Messagebox.show(ex.tostring) End Try Else messagebox.show("file does not exist) End if ///
Making empty catch blocks is the worst thing you can do.
Right now I have the Catch change the timer to a longer tick just to give it
some time before trying it again. I put the file.exists in a try/catch block
as well because I just can't stop the program from doing a full crash and
rebooting the system right away when the DOS server is restarted. The file
check/copy process is happening every 10 seconds so is there any other way
to do the check/copy so that it will not crash? Hope someone has some ideas.
Sarah,
Than maybe you have your problem directly. The catch is only slow the first
time it is used.
However you would surely not use that in my opinion for what you tell you
want to archieve.
I hope this helps?
Cor Than maybe you have your problem directly. The catch is only slow the
first time it is used.
What I said is when a try block enters a catch exception I have it so that
the timer tick does not check as frequently - i.e. not check every 10
seconds. That has nothing to do with the crash problem. You asked that a
catch exception should not be empty - which, I'm not sure should be a
problem - so, I mentioned what I have put there. (i.e. putting a msgbox in a
catch exception - that does not prevent the system from crashing).
I'm still looking for code that would not crash when the DOS server goes
down (i.e. is in a restart or is off).
However you would surely not use that in my opinion for what you tell you want to archieve.
I hope this helps?
Cor
Sarah, What I said is when a try block enters a catch exception I have it so that the timer tick does not check as frequently - i.e. not check every 10 seconds. That has nothing to do with the crash problem. You asked that a catch exception should not be empty - which, I'm not sure should be a problem - so, I mentioned what I have put there. (i.e. putting a msgbox in a catch exception - that does not prevent the system from crashing).
What prevents it than?
Cor
That's my question! That's why I provided the code and am asking someone who
can help me figure it all out.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:#y**************@TK2MSFTNGP11.phx.gbl... What prevents it than?
Cor
Sarah, That's my question! That's why I provided the code and am asking someone who can help me figure it all out.
Therefore I wrote to set the messagebox in that catch, than is probably
better showed what gives the error.
The code you now have showed is something I would not even type in a message
so bad is it.
(The messagebox is only a timely part for a better error resolving
procedure)
Cor
Cor, please don't respond to any of my posts any more - you either always
seem to misunderstand my questions or post unhelpful comments. Thank you.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:Ov**************@TK2MSFTNGP09.phx.gbl... Sarah, That's my question! That's why I provided the code and am asking someone who can help me figure it all out. Therefore I wrote to set the messagebox in that catch, than is probably better showed what gives the error.
The code you now have showed is something I would not even type in a
message so bad is it. (The messagebox is only a timely part for a better error resolving procedure)
Cor
No problem at all, I hope for you that someone find a solution for you,
however mostly when I give a wrong answers someone else corrects me, what is
normal in a newsgroup.
I saw never corrections with your questions.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike |
last post by:
Greetings,
Having a major problem here. running version 8.2 on win2003 server.
The problem I am having is backing up a database seems to get to the
last part of the backup and then fails. This...
|
by: Adam Louis |
last post by:
I would like help resolving this problem. I'm a novice who's been
hired to query a hospital database and extract useful information,
available to me only in a dynamically generated, downloadable...
|
by: JK Peck |
last post by:
I have a fairly large Access application that ran correctly in Access
2000. After upgrading to Access 2003 (and recompiling and updating
references), it reliably crashes at a certain point. If I...
|
by: Jamma |
last post by:
Hello,
I have an Access 2000 file working on XP machines and a NT network.
The files are split and 95% of the time all is well and stable. The
main issue arises when the app prints,a novell...
|
by: ray |
last post by:
I have a client that doesn't want Access to automatically repair into a
backup file if it crashes (and it crashes only on very rare occasions).
My (sketchy) understanding is that this is a...
|
by: dan_roman |
last post by:
Hi,
I developed a script with a nice interface in Tkinter that allows me to
edit some formulas and to generate an Excel worksheet with VBA macros
within it. The script runs perfectlly in Office...
|
by: alf |
last post by:
Hi,
is it possible that due to OS crash or mysql itself crash or some e.g.
SCSI failure to lose all the data stored in the table (let's say million
of 1KB rows). In other words what is the worst...
|
by: Keith G Hicks |
last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher"
project. Starting and stopping the watcher and reading my XML file work
fine. Once the watcher is started, I'm reading...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: 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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |