Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem when setting the ReadOnly state of a property: CLOSED

Problem when setting the ReadOnly state of a property: CLOSED

Scheduled Pinned Locked Moved Visual Basic
helpcssannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mo1492
    wrote on last edited by
    #1

    Aaaaaaaaaaaaaaaaaarg! As usual once I post I figure it out. The PropertyGrid does not maintain the state. It has to be reloaded. How Dumb. Sorry Hello all, I have a problem where the PropertyGrid does not update a property when changing a property to ReadOnly and not ReadOnly. The problem occurs when I have 2 controls of the 'same type'. Below is test code which contains all of the things I have tried to refresh the PropertyGrid with no success. When Control1 is loaded into the PropertyGrid I change the DesignLocked state and update the ReadOnly state of the PostPrintString to Readonly or not ReadOnly depending on the DesignLocked Value. This works in Control1. However, after I have changed the value in Control1 and then select Control2 into the PropertyGrid (through a button click in MainForm), the PostPrintString property in the grid maintains the same ReadOnly state of Control1. I've tried a number of things I've seen on google including NotifyParentPropertyAttribute with no success. I would appreciate any help with this. Thank you This is the test code in MainForm to load each control. Private Sub Ctrl1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ctrl1.Click Me.PropertyGrid1.SelectedObject = Nothing Me.PropertyGrid1.Refresh() Me.PropertyGrid1.SelectedObject = Me.ctrl1 Me.PropertyGrid1.Refresh() End Sub Private Sub Ctrl2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ctrl2.Click Me.PropertyGrid1.SelectedObject = Nothing Me.PropertyGrid1.Refresh() Me.PropertyGrid1.SelectedObject = Me.ctrl2 Me.PropertyGrid1.Refresh() End Sub Below is the test code in a UserControl that shows what I do when I change the DesignLocked property. Imports System.ComponentModel Imports System.Reflection Public Class TestUserControl ' Gets loaded with MainForms PropertyGrid Public _PropertyGrid As PropertyGrid _ Public Property PostPrintString() As String Get Return "" End Get Set(ByVal value As String) End Set End Property ''' ''' Get

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups