Hi there -
you can use whatever you want for a datasource, as long as it implements
either of IList or IListSource interface.
About the current cell - you can use either the CurrentCellChanged event or
the MouseDown Event of the grid.
There's a class called TestHitInfo with which you can check which is the
current cell, at any time.
Here's an example from the MSDN online documentation:
protected void dataGrid1_MouseDown
(object sender, System.Windows.Forms.MouseEventArgs e)
{
Console.WriteLine();
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
// Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = dataGrid1.HitTest(e.X,e.Y);
Console.WriteLine(myHitTest);
Console.WriteLine("Column " + myHitTest.Column);
Console.WriteLine("Row " + myHitTest.Row);
Console.WriteLine("Type " + myHitTest.Type);
Console.WriteLine("ToString " + myHitTest.ToString());
Console.WriteLine("Hit " + myHitTest.Type.ToString());
}
Cheers,
Branimir
--
Branimir Giurov
MCSD.NET, MCDBA
"Ananth" <an*****@gmail.com> wrote in message
news:d1**************************@posting.google.c om...
Hi,
I have a question regarding data grids
My application requires me to use a grid for displaying data, however
I would not be using a database for procuring the data, instead I
would be exposing interfaces for other methods to pass me the data
that needs to be displayed. In such a case is the data grid the best
control to use in .NET?
Also if I am using a data grid, how can I obtain the value in the
current cell of the data grid?(where the user has clicked within the
data grid)
Thanks,
Ananth