I have a DGV (dgvListOfJobs), populated from an SQL database to show the user a list of 'jobs' (i.e. rows). I also show 7 other DGV's (dgvMonday, dgvTuesday, etc) for each day of the week so the user can drag a job from the list and drop it onto a particular day. Once dropped I update the SQL record with a corresponding date. The user can also drag and drop between days, or drag a job back to the main job list to remove it from the week's jobs (i.e. the SQL writes a null to the date field). This all works fine.
However - if a user picks up a job and drops it onto the same dgv, it still triggers the 'dropped' event and writes a date, or a null, to the SQL. I want to have a check at the start of the 'drop' procedure so if the job was picked up and dropped back into the same DGV, the drop event quits straight away without re-writing the SQL.
I could read the SQL to see if the date matched but this involves an EXTRA sql access and I am trying to speed up the process by removing an SQL event if at all possible.
After Googling for a solution I think it may be something to do with 'DirectCast' but I can only get this to report 'DataGridView' as the source, not the name of a specific dgv - 'dgvThursday' for example.
I notice the 'DragDrop' event paramters include a 'sender' object but cannot work out how to utilise this (and even if it will help!)