I’m still quite new to programming and I started with C#. I want to make a simple application that accepts an error number from the user, for example: “F_220”. Read data from the table, find this place in the table and use columns and rows to provide an explanation for this error. For example, there is a table with cells: B:13 – “F_220” and C:13 – “Error, do something”. I found ClosedXML in. If this is a good tool, please help, if not, what can be used?
I understand that this is the wrong code
private void Excel()
{
using var workbook = new XLWorkbook("C:\Users\admin\Desktop\VSC-500.xlsx");
var ws1 = workbook.Worksheet(1);
string error = textBox1.Text;
var rowCount = workbook.Worksheet(1).LastRowUsed().RowNumber();
var columnCount = workbook.Worksheet(1).LastColumnUsed().ColumnNumber();
int column = 1;
int row = 1;
List<string> ll = new List<string>();
while (row <= rowCount)
{
while (column <= columnCount)
{
string title = workbook.Worksheets.Worksheet(1).Cell(row, column).GetString();
ll.Add(title);
column++;
}
row++;
column = 1;
}
var container = ll.FindAll(s => s.Contains(error));
var str = string.Join(",", ll);
MessageBox.Show(str);```
What is L is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.