I wrote a program using VB.NET. When I run the executable, it displays a DataGridView that may (or may not) have rows in it. The user can enter data, or hit an Update button to fetch data from a database. (The grid is NOT being used as a DataSource.)
The user can also set the font with another button: DataGridView1.font = "..."
If the grid DOES have rows in it, everything works as expected and the font is used in the grid.
If the grid does NOT have rows in it, the font does NOT change. Even after the user hits Update, or types in data.He has to entirely exit the program, and rerun it to see the font actually change.
Question:
How do I set the font on the grid, regardless of whether it:
- Has rows.
- Doesn’t have rows.
- Will have rows later.
I would think DataGridView1.font would ALWAYS change the font. No?
You can use the property EmptyGridview with a CssClass to change the way it displays this message.
For example:
Aspx
CSS
Have a nice day!!