Help with user control DefaultValue

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I'm creating a user control with a DataGridView in it. In setting the
DefaultValue for some of the properties I had to use code like the
sample below:

<DefaultValue(GetType(System.Windows.Forms.ScrollBars), "3"),
Description("The type of scroll bars to display for the
EnhancedDataGridView control.")> _
Public Property ScrollBars() As System.Windows.Forms.ScrollBars
Get
Return DataGridView1.ScrollBars
End Get
Set(ByVal value As System.Windows.Forms.ScrollBars)
DataGridView1.ScrollBars = value
End Set
End Property

That works correctly. How do I set the DefaultValue for objects.
Below is an example. What would I replace the "???" with?

<DefaultValue(GetType(DataGridViewCellStyle), "???"), Description
("The default cell style applied to odd-numbered rows.")> _
Public Property AlternatingRows() As DataGridViewCellStyle
Get
Return DataGridView1.AlternatingRowsDefaultCellStyle
End Get
Set(ByVal value As DataGridViewCellStyle)
DataGridView1.AlternatingRowsDefaultCellStyle = value
End Set
End Property
 
Paul,

You set the default value of your usercontrol in the constructor of the
class, which can be as well in the base class of your usercontrol.

Cor
 
Back
Top