You're only running the following line if dbcontext != null
... but it's null
when your form first loads, so the code inside that if
block is never going to execute.
dbcontext = new HospitalDatabase.HospitalEntities();
You'll have to rework your logic. Maybe something as simple as this, where you check the value before disposing of the object, but then run the rest of the code regardless.
//Dispose of old dbcontext, if any
if (dbcontext != null)
dbcontext.Dispose();
//create new dbcontext so we can reorder records based on edits
dbcontext = new HospitalDatabase.HospitalEntities();
Note that I can't comment on whether disposing and creating a new entity like this is a good practice - I'm not familiar enough with the technology. I'll trust that it is.