Question: I'm compiling a program on gcc by using `-Wbad-function-cast` flag. The gcc show the following warning: 

`cast does not match function type`

this is line of warning: `int ret = (int)`[`FindExecutable(file, NULL, result)`](http://msdn.microsoft.com/en-us/library/windows/desktop/bb776419%28v=vs.85%29.aspx)

The question is: it's possible remove it? maybe casting to another windows data type, but that I handling it as an integer.

Answer: 
1.5 improvements for the event *GridView.DragDrop*:

1. The first 50% improvement, To avoid the descriped error you can also use 

```
Private Sub DgvSearchFieldCurrent_DragDrop( _
   ByVal sender As  Object, ByVal e As DragEventArgs) _
   Handles DgvSearchFieldCurrent.DragDrop

Dim LclDgv As DataGridView = CType(sender, DataGridView)

If dragIndex > -1 AndAlso dragIndex < LclDgv.RowCount -1 Then

```
2. Second is to set focus to the current row and the first cell:

```
LclDgv.Rows.Insert(dragIndex, dragRow)

LclDgv.Rows(fromIndex).Selected = False
LclDgv.Rows(dragIndex).Selected = True

For Each C As DataGridViewColumn In LclDgv.Columns
  LclDgv(C.Index, fromIndex).Selected = False
Next

LclDgv(0, dragIndex).Selected = True

```
Thank you for everything, code working. I was getting only one error. I solved it.

if the datagridview "Enable Editing" is set, you receive an error when you throw line spacing. You can try. I solved it as follows:

```
    Private Sub DataGridView1(ByVal sender As Object, ByVal e As DragEventArgs) Handles DataGridView1.DragDrop

    Dim p As Point = DataGridView1.PointToClient(New Point(e.X, e.Y))
                    dragIndex = DataGridView1.HitTest(p.X, p.Y).RowIndex
                    If (e.Effect = DragDropEffects.Move) Then
                        Dim dragRow As DataGridViewRow = CType(e.Data.GetData(GetType(DataGridViewRow)), DataGridViewRow)

                        If dragIndex = DataGridView1.RowCount - 1 Then '**ADD THIS AREA**
                            DataGridView1.Rows.RemoveAt(fromIndex)
                            DataGridView1.Rows.Insert(DataGridView1.RowCount - 1, dragRow)
                        Else
                            If dragIndex < 0 Then dragIndex = DataGridView1.RowCount - 2 '**this is important**
                            DataGridView1.Rows.RemoveAt(fromIndex)
                            DataGridView1.Rows.Insert(dragIndex, dragRow)
                        End If
                    End If
End Sub

```

Thanks for all other information