2
namespace _06_Teste
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdValidar_Click(object sender, EventArgs e)
{
foreach (String file in Directory.GetFiles("c:\\ImgRoute\\Caixa9 D1\\", "*.*"))
{
FileInfo fileName = new FileInfo(file);
string imag = fileName.Name;
if (imag.Length == 16)
{
//("Numero do auto correto");
}
else
{
//("Numero do auto invalido");
}
}
}
}
}
Armanda, I have edited your question so that I think it will be better. It would be necessary, however, for you to explain what is the problem you encounter with your code.
– ramaral
The code is not running. And I would like to know how best to display the error if the file name does not have 16 digits.
– Amanda
@Amanda you have to say what is going on. Is it wrong? Which one? Gives an unwanted result? Which one would be expected? Edit the question and give details, we can’t guess what your problem is. What’s the file name? Is it just the name without the extension? Com? With the path complete? When developing software we should be detailed.
– Maniero