I'm developing a basic program in C # where the user will enter values through a bar code reader. The same will be saved in an Excel spreadsheet for a future report.
My problem is that there are situations where the user bipes the same code twice in different textbox.
I wanted to know if, by clicking on my button Salvar
, I had an event to compare all my textboxes and check for repeated values, preventing me from saving duplicate information.
Below is my Button's code Add:
private void BtnAdicionar_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook sheet = Excel.Workbooks.Open("C:\Users\Core i3\Desktop\EtiqMasterBoxTornozeleira.xlsx");
Microsoft.Office.Interop.Excel.Worksheet x = Excel.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet;
Excel.Range userRanger = x.UsedRange;
int countRecords = userRanger.Rows.Count;
int add = countRecords + 1;
}