Question: My program loads data from a MySQL database into a `DataGridView`. I want to hide the first column (`id` column), but I get the reentrance cell error.

CODE:

```
void dataGridGlavni_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
    {
        if (this.dataGridGlavni.Columns[e.ColumnIndex].Name == "id")
        {
            this.dataGridGlavni.Columns[e.ColumnIndex].Visible = false; // <<<< error
        }
        if (this.dataGridGlavni.Columns[e.ColumnIndex].Name == "Plate za mesec")
        {
            GlavniForm.ShortFormDateFormat(e);
        }
    }

```

ERROR:

> 
> Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
> 
> 
> 

The error also appears when I use the following line:

```
this.dataGridGlavni.Columns[0].Visible = false;

```

However it does NOT appear when I use these lines:

```
this.dataGridGlavni.Columns[1].Visible = false;

```

OR

```
this.dataGridGlavni.Columns["Plate za mesec"].Visible = false;

```

I googled a lot and haven't been able to find the source of the error. What is happening why won't it let me hide the first column ?

Thank you

Answer: 
Worked perfectly for me to calculate **SQL database size** in **SQL Server 2012**

```
exec sp_spaceused

```

[![enter image description here](https://i.stack.imgur.com/jctbV.png)](https://i.stack.imgur.com/jctbV.png)
`EXEC sp_spaceused @oneresultset = 1` 
show in 1 row all of the result

if you execute just 'EXEC sp\_spaceused' you will see two rows
Work in SQL Server Management Studio v17.9