I have a problem trying to run this code, what I try to do is that in column 9 the "," and the "." are taken into account, the code is as follows:
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+textBox1.Text+";Extended Properties=Excel 12.0");
OleDbDataAdapter da= new OleDbDataAdapter("SELECT * FROM [Hoja1$]", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.Columns[9].ValueType = typeof(decimal);
dataGridView1.Columns[9].DefaultCellStyle.FormatProvider = ci;
dataGridView1.Columns[9].DefaultCellStyle.Format = "N2";
dataGridView1.DataSource = dt;
The error you send me is as follows:
index was out of range. Must be non-negative and less than the size of the collection.
The table contains 18 columns, so I do not know why this error appears.