hi,all
I want to get some cells in DataGirdView by GetChildAtPoint() method.
for example:
private void dataGridView1_DragDrop(object sender, DragEventArgs e)
{
Point point = new Point(e.X, e.Y);
Point pointOfClient = this.dataGridView1.PointToClient(point);
Control control = dataGridView1.GetChildAtPoint(pointOfClient);
string a = ((DataGridTextBox)control).Text;
}
in this method ,I use GetChildAtPoint to get the values of cells,when executed,I found the control is null. I want to know the reason of it .
in addition ,is there another method to help me get the values of current cell when DragDrop.
thanks
Michaelliu

help
george22
hi vkh78,
thanks for your advice, I have already got the value of cells.
could you tell me how to use the GetChildAtPoint method,thanks.
Michaelliu
Chris Vance
I think a DataGridView doesn't host any controls except HScrollBar and VScrollBar. You can check it with the following statements:
For
Each c As Control In Me.MyDataGridView.ControlsConsole.WriteLine(
c.GetType().ToString()) Nextkalkie
Dim
p As Point = MyDataGridView.PointToClient(New Point(e.X, e.Y)) Dim hti As DataGridView.HitTestInfo = MyDataGridView.HitTest(p.X, p.Y) Dim cell As DataGridViewCell = MyDataGridView.Rows(hti.RowIndex).Cells(hti.ColumnIndex)Console.WriteLine(
"Current cell value is: " & cell.Value)Komyg