Thursday, 13 June 2013

disable(readonly) all control of a form(window) from other window in vb.net

Hi  i  made all control except close button disable all read only in this way. my all control in the panel and i disable all that and also made disable all toolbar control


Private Sub FrmTodoList_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

  If IsReadOnly Then
            DisableAll()
        End If
    End Sub

 Private Sub DisableAll()
        Me.PnlCSDetail.Enabled = False
        For Each tool As Infragistics.Win.UltraWinToolbars.ToolBase In Me.TBMCSDetail.Toolbars(0).Tools
            If Not tool.Key.ToLower.Equals("dclose") Then
                tool.SharedProps.Visible = False
                tool.SharedProps.Enabled = False
            End If
        Next

 Public Property IsReadOnly() As Boolean
        Get
            Return _isReadOnly
        End Get
        Set(ByVal value As Boolean)
            _isReadOnly = value
        End Set
    End Property
Regards:
Ahmad Khalid
Software Engineer