Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridview1.CellClick
If DataGridview1.CurrentCell.OwningColumn.Name = "TransDate" Then
Dim objPoint As Point
'Getting the exact location of the cell with respect to Form1.
'Note- Me.Location is added here alongwith DataGridView1.Location
'and DataGridView1.GetDisplayRectangle().Location.
'This is done because the form frmDate we are calling is external to
'Form1 and if we don't add Me.Location
'here, frmDate won't open exactly at the desired point if we move or
'resize Form1. Instead of frmDate if
'we use any control inside Form1 to place over 'TransDate' column then
'remove Me.Location here and the
'next two lines.
objPoint = (Me.Location + DataGridview1.Location +
DataGridview1.GetCellDisplayRectangle(8,
DataGridview1.CurrentCellAddress.Y, True).Location)
'Setting the exact location where frmDate will be opened. The last
'digits may vary according to your
'requirement.
objPoint.X = objPoint.X - 158
objPoint.Y = objPoint.Y + 28
objFrmDate = New frmDate()
objFrmDate.Location = objPoint
objFrmDate.ShowDialog(Me)
objFrmDate = Nothing
End If
End Sub