1. When the system is running, load a form, but two identical codes will appear.
Cause:
This time the form was used directly. I didn't expect it when I used it. I just thought that the interface would not be painted. I didn't expect this effect.
Solution:
If you want to use the original interface, copy the form control and do not add the entire existing project directly.
Lessons learned:
If you want to be lazy or be considerate, you can use a line to test it. If this is the case, continue to be lazy.
2. the string or binary data will be truncated. The statement has been terminated.
Cause: the length of a field in the database table used is too short.
3. You have not set the object reference to the instance of the object.
<1>. export data from the datagridview control to the Excel prompt "object reference is not set to the instance of the object. "
Cause:
When the datagridview control loads data, a blank row is automatically added. When other data exists in the table and the program runs, no error is reported, but an error occurs when the program runs when no other data exists, because the cell value is empty at this time, when myexcel is performed. cells (I + 2, J + 1) = maid (J, I ). value. this error occurs when tostring is used.
Solution:
(1)
A. Remove tostring
B. Set the allowusertoaddrows attribute of the datagridview control to false.
(2)
First, judge the value. If it is not empty, perform the tostring operation.
<2> when you delete the selected row in the datagridview control, the following message is displayed: "The object reference is not set to the instance of the object"
Cause: no data in the dview.
Solution:
The solution is the same as that of <1>.
4. When inserting data into the database, the system prompts that the operation was successful. However, when I checked the table, I found that there was no data in the table.
Cause: Due to my carelessness, the amount of data operated is not large, I don't know if you like me to right-click a table in the database and select "Edit first 200 rows? Haha, I believe you have understood this. This time, my data is not as small as before. If there are more than 200 rows, it will not be displayed. Therefore, it is not because the data is not written. do not make similar mistakes.
5. When the Parent and Child forms are set, the child forms of the program are blocked by the control of the parent form.
Solution:
(1)
A. Set the ismdicontain attribute of the main form to true. Then it is the parent form.
B. re-create a form, copy the control in the parent form to the form, and then set some properties of the form so that it is attached to the parent form, in this case, we cannot see that there are two forms.
C. Set attributes
Borderstyle = none' set the border of the form to borderless
Controbox = false': set no system button in the form
Windowstate = maximized 'sets the form to maximize
D. You need to make
Child form. mdiparent = parent form
For example:
Frmqrystubalance. mdiparent = me
Frmqrystubalance. Show ()
(2)
A. Set the ismdicontain attribute of the main form to true. Then it is the parent form.
B. Cut the controls in the main form. In this case, you must use the panel control in the form, and then place the controls you just cut back to the original place.
C. You need to make
- Subform. toplevel = false
- Parent form. Panel. Controls. Add (child form)
For example:
Frmqrystubalance. toplevel = false
Me. panel1.controls. Add (frmqrystubalance)
Frmqrystubalance. bringtofront ()