There are two forms. On the first form data base with akses. On the second form there is a datagrid, where headers are filled in the form of a square matrix ( Example ). How to make the grid cells automatically resize depending on the text, but it turns out like this: 