K
K
kLkA2012-09-11 18:48:36
.NET
kLkA, 2012-09-11 18:48:36

C# Error creating file before form is run

In the program, the data is taken from the XML file
. When the file does not exist for the first time, an error is generated that the file does not exist.
image
Tried creating the file before running application.run(form1) etc.
Also tried to stop the thread for 10 seconds ( Thread.sleep(10000) ). The file was created, but after 10 seconds there was still a warning
How to create a file so that there is no error warning?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AxisPod, 2012-09-11
@AxisPod

Apparently change the architecture and handle exceptions correctly. You can tell a lot here, look towards observer design patterns, look towards working with threads, in particular BackgroundWorker, etc.

S
SergeyGrigorev, 2012-09-11
@SergeyGrigorev

Is the file read on request, or is there some kind of static singleton class that generates a link when it is created? Perhaps the generation of a link to the file occurs at the time of initialization.

G
GavriKos, 2012-09-11
@GavriKos

If the form itself takes the data, then create a file in its init.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question