///<Summary>If adding a family, this will be called repeatedly.</Summary> public void AddAppointment(Bitmap bitmap, long aptNum, DataRow dataRow) { for (int i = 0; i < ListPinBoardItems.Count; i++) { if (ListPinBoardItems[i].AptNum == aptNum) { //The appointment being passed in is already on the pinboard. //Remove the old one so that we can replace it with the new one. //This happens when the appointment changes provider, for example. ListPinBoardItems[i].BitmapAppt.Dispose(); ListPinBoardItems.RemoveAt(i); break; } } PinBoardItem pinBoardItem = new PinBoardItem(); pinBoardItem.AptNum = aptNum; pinBoardItem.BitmapAppt = new Bitmap(bitmap); //so that we can dispose of the one that was passed in pinBoardItem.DataRowAppt = dataRow; List <long> listAptNums = new List <long>() { aptNum }; pinBoardItem.TableApptFields = Appointments.GetApptFieldsByApptNums(listAptNums); List <long> listPatNums = new List <long>() { PIn.Long(dataRow["PatNum"].ToString()) }; pinBoardItem.TablePatFields = Appointments.GetPatFields(listPatNums); ListPinBoardItems.Add(pinBoardItem); _selectedIndex = ListPinBoardItems.Count - 1; Invalidate(); }