Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Changing Custom Control Property
 

Changing Custom Control Property

How can I make a property change value of another property at design time? I have added HighlightRow property to custom DataGrid control. Now I want to assign this property similar to DataGrid’s ReadOnly property. For instance, when in property window ReadOnly property is set to True, the HighlightRow property should be set to true and vice-versa. I did something like this does not seems to work 

Public Shadows Property [ReadOnly]() As Boolean 
    Get 
      Return m_blnReadOnly 
    End Get 
    Set(ByVal Value As Boolean) 
      m_blnReadOnly = Value 

      If Value Then 
        Me.HighlightRow = True 
      Else 
        Me.HighlightRow = False 
      End If 

    End Set 
  End Property 

  <Browsable(True), Description("Determines whether to highlight current row when ReadOnly property is set to True. By default set to False."), DefaultValue(False)> _ 
Public Property HighlightRow() As Boolean 
    Get 
      Return m_blnHighlightRow 
    End Get 
    Set(ByVal Value As Boolean) 
      m_blnHighlightRow = Value 
    End Set 
End Property 

Thanks 
MigrationUser 1  Saturday, February 19, 2005 3:18 AM
You should just be able to use a set statement of:

Set(ByVal Value as Boolean)

m_blnReadOnly = Value
m_blnHighlightRow = Value

End Set


... for both the HighlightRow and shadowed ReadOnly properties.
MigrationUser 1  Tuesday, February 22, 2005 5:07 PM

You can use google to search for other answers

Custom Search

More Threads

• datagrid cell handler
• Adding Rows With a 2D Array
• Inserting row into user sorted, data-bound DataGridView
• Read a database from one form and update from another?
• array assigning problem
• how can i select all checkboxes by clicking a button or checking another checkbox
• Creating a templatefield programmatically
• different fore- or background - colors in a datagridview cell
• slow datagridview painting
• Windows Form Stored Procedure Won't Actually INSERT data