Tak więc wybieram elementy z listy , ale nie wiem jakiego te elementy są typu więc:
List<DataGridViewRow> lista = new List<DataGridViewRow>(); // wybrane elementy
if (granicznyElement.GetType()== typeof(DateTime))
{
for (int i = 0; i < Rows.Count; i++)
{
if ( ((DateTime)Rows[i].Cells[ktoraKolumna].Value) >= (DateTime)granicznyElement)
{ lista.Add(Rows[i]); }
}
}
else if (granicznyElement.GetType() == typeof(int) || granicznyElement.GetType() == typeof(long))
{
for (int i = 0; i < Rows.Count; i++)
{
if (((long)w.Rows[i].Cells[ktoraKolumna].Value) >= (long)granicznyElement)
{ lista.Add(Rows[i]); }
}
}
else if (granicznyElement.GetType() == typeof(decimal) || granicznyElement.GetType() == typeof(float))
{
for (int i = 0; i < Rows.Count; i++)
{
if (((decimal)Rows[i].Cells[ktoraKolumna].Value) >= (decimal)granicznyElement)
{ lista.Add(Rows[i]); }
}
}