enjoyit
2016-04-18T09:30:16Z
Hi,

how can i set the font to bold with the RowDynamicFormatting method?

_RowDynamicFormatting(ByVal lRow As Long, oForeColor As Long, oBackColor As Long, oFont As Object)

I know that I have to use the oFont object, but how? :-)

thanks

Edit: I am using Microsoft Access
Igor/10Tec
2016-04-19T09:31:55Z
You need to create a module-level StdFont object with the required formatting and then use it this way:

Private Sub iGrid1_RowDynamicFormatting(ByVal lRow As Long, _
      oForeColor As Long oBackColor As Long, oFont As StdFont)
	  
   If iGrid1.CellValue(lRow, "country") = "USA" Then
      Set oFont = m_oBoldFont
   End If
   
End Sub
enjoyit
2016-04-19T09:44:20Z
thanks for reply!

The problem is, that Access only offers me "oFont As Object" not the StdFont. If I replace it with the StdFont I get an error. Link is set to ole-automation!

I think I am on the wrong way -.-

Can you give me hint? What do you mean with "creating a module-level StdFont Object"? 🙂
Igor/10Tec
2016-04-19T14:21:20Z
The following code works perfectly in MS Access 2010:

Option Compare Database
Option Explicit

Dim m_oBoldFont As StdFont

Private Sub Form_Load()
   Set m_oBoldFont = New StdFont
   m_oBoldFont.Bold = True

   Dim ig As iGrid
   Set ig = iGrid0.Object
   With ig
      .BeginUpdate
      
      .ColCount = 3
      .ColDefaultCell(1).vValue = "Text"
      .RowCount = 5
      
      .EndUpdate
   End With
End Sub

Private Sub iGrid0_RowDynamicFormatting(ByVal lRow As Long, oForeColor As Long, oBackColor As Long, oFont As Object)
   If lRow Mod 2 = 0 Then
      Set oFont = m_oBoldFont
   End If
End Sub

The bold font is set for even rows dynamically.
enjoyit
2016-04-20T06:20:34Z
Thank you so much!
You are my hero. 🙂