During development, copy the control from an existing form and paste it to the new form. After adjustment, add the new control. In most cases, there is no problem. However, I recently encountered a problem: I copied the dview and some other controls to the new form and added several buttons. At first there was no problem. Later, I set many datagridview attributes, when you are satisfied, an error occurred while adjusting the property compilation of other buttons.CodeThe datagridview dview is not found, but it does exist on the interface. It is found that the declaration of this control is not found in the last control declaration of the designer file. Therefore, the Declaration is manually added and compiled. However, when I adjusted the interface control attributes, the Declaration was gone. After repeated experiments, it was found that some of the controls copied from other forms are in the designer file, but they are not displayed on the interface and are useless, so they are deleted, adjust the interface control again. The problem does not exist.
It takes a long time to discover the problem, which is recorded here.