I want my datagridview to have one row formatted with 2 decimals and second row should not have decimals at all (the values should be rounded).
I use such code
Private
Sub
FormatTotalGrid( _
ByVal
PercFormat As
String
, _
ByVal
SumFormat As
String
, _
ByVal
dgvSrc As
DataGridView)
dgvSrc.Rows(0).DefaultCellStyle.Format = PercFormat
dgvSrc.Rows(1).DefaultCellStyle.Format = SumFormat
'dgvSrc.Refresh()
End
Sub
The problem: I noticed that datagridview should be displayed at least once before such changes can be applied. My datagridviews are on tabpages which are not active at the moment when application starts. So user needs to go to every tabpage and only then I can reapply styles to datagriviews I need to change.
Why such things are happening? Formatting works fine while I format columns. But if I start format rows or cells the formattin is not applied until the control is displayed at least once.
Be cool! Help a noob