1
People to better specify my problem, it is like this: I have a system that performs barcode reading and, in this precise system that the txt file that is receiving the code does not receive duplicate/repeated files, IE, it can not receive the same code 2 times.
I’m having problems doing this without a database and because the windows platform where this system will run is very old I have to program on VS2008.
Below is a part of the code, where the file Count.txt is created by the system and the file receives the barcode and the collection location:
if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Contagem.txt"))
{
File.Create(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Contagem.txt").Close();
}
StreamWriter sw = new StreamWriter(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Contagem.txt", true);
sw.WriteLine("|" + txtCodBarras.Text + "|" + txtLocal.Text.Substring(txtLocal.Text.Length - 3) + "|");
sw.Close();
sw.Dispose();
you will have to read the entire file, and check if the code already exists in it
– Rovann Linhalis
But I need the software to do it alone.
– Dérick Luiz
put the code you already have ready, then we assist you with examples
– Rovann Linhalis
I will edit the post
– Dérick Luiz
to better specify your problem, include your code
– Leandro Angelo
Ready I’ve made the edit
– Dérick Luiz