-
Notifications
You must be signed in to change notification settings - Fork 0
/
1 - Open_Click.txt
32 lines (28 loc) · 1.03 KB
/
1 - Open_Click.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
private void Open_Click(object sender, EventArgs e)
{
filepath = "\\\\path\\Histórico Clinico.xlsx";
sheet = "Sheet1";
Excel abrir = new Excel(filepath, sheet);
string[,] matriz = abrir.ReadRangeCell(1, 1, 172, 8);
dataGridView2.Rows.Clear();
for (int i = 1; i < matriz.GetLength(0); i++)
{
string[] row = new string[matriz.GetLength(1)];
for (int j = 0; j < matriz.GetLength(1); j++)
{
if (matriz[i, j] != null)
{
row[j] = matriz[i, j];
comparar[i, j] = matriz[i, j];
}
else
{
row[j] = "";
comparar[i, j] = "";
}
}
dataGridView2.Rows.Add(row);
}
abrir.Close();
buttonAdd.Enabled = true;
}