3
I’m developing a new functionality for a project Winforms in C#. Soon I developed the following method that returns itself in the component GridControl (gvDados)
there is a line selected or not.
public bool RetornaSelecionado(bool Selecionado)
{
int linhas = 0;
foreach (int i in gvDados.GetSelectedRows())
{
DataRow row = gvDados.GetDataRow(i);
linhas++;
//TESTE MessageBox.Show(row[0].ToString());
}
if(linhas > 0)
{
MessageBox.Show("Selecionou");
return Selecionado = true;
}
else
{
MessageBox.Show("Não selecionou");
return Selecionado = false;
}
}
The method worked as I expected. When I select an item in the component the message is displayed Selected and when not selected, the message Did not select is displayed. After this a question arose, how should I proceed to store the data from row
in one another array
so that I can use in another system validation?
what is
gvDados
?– Marconi
is the name of my Gridcontrol
– Leonardo
Debug your code and get the information from
DataRow
, ai just assign in the array you want!– Marconi
i did a more amateur act kkkkk... That line commented there in the code was to know which item (ID, Name, Sector) is being "caught" by
DataRow
, and is the ID...– Leonardo