I was wondering if the was a way to pass a control's name to a Sub. I have looked, cannot find anything that works. I have tested various scenarios but cannot get anything to work. Maybe I do not know what I am looking at.
I have several DGV's that have common code. So instead of coding each one differently I would life to pass the name, in this case the DGV design name, dgvSolarSystem.
would like to pass that to the Sub.
I have several DGV's that have common code. So instead of coding each one differently I would life to pass the name, in this case the DGV design name, dgvSolarSystem.
would like to pass that to the Sub.
Code:
Me.dgvSolarSystem.EnableHeadersVisualStyles = False
With Me.dgvSolarSystem.ColumnHeadersDefaultCellStyle
'.Font = New Font(dgvSolarSystem.Font, FontStyle.Bold)
.BackColor = Color.Gainsboro
.Alignment = DataGridViewContentAlignment.MiddleCenter
End With
'Format DGV Rows = Aternate Colors
Dim objAlternatingCellStyle As New DataGridViewCellStyle() With {.BackColor = Color.WhiteSmoke}
Me.dgvSolarSystem.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle