-
How to lock combobox
Hello friends,
I am facing an issue while locking an combobox.I am not able to do it.I have try to find the solution over internet but of no use.Can anyone help me out with this issue.
Intel Core 2 Duo 2.8 Ghz
G31 Asrock Motherboard with Intel chipset
2gb RAM
256 Nvidia Graphic Card
200gb HDD
-
Re: How to lock combobox
Sure i will help you out with this before that may i know in which programming language are you trying to use this code.
-
Re: How to lock combobox
I am trying to use it in .net.Please help me out with this.
Intel Core 2 Duo 2.8 Ghz
G31 Asrock Motherboard with Intel chipset
2gb RAM
256 Nvidia Graphic Card
200gb HDD
-
Re: How to lock combobox
Try to use this code
HTML Code:
Public Class PMCombo
Inherits System.Windows.Forms.ComboBox
Protected _ReadOnly As Boolean
Protected _OldIndex As Integer
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Public Property IsReadOnly() As Boolean
Get
Return _ReadOnly
End Get
Set(ByVal Value As Boolean)
_ReadOnly = Value
If _ReadOnly Then
Me.BackColor = System.Drawing.SystemColors.Control
Else
Me.BackColor = Color.White
End If
End Set
End Property
Public Overrides Property SelectedIndex() As Integer
Get
Return MyBase.SelectedIndex
End Get
Set(ByVal Value As Integer)
_OldIndex = Value
MyBase.SelectedIndex = Value
End Set
End Property
Protected Overrides Sub OnSelectedIndexChanged(ByVal e As System.EventArgs)
If IsReadOnly Then
Me.SelectedIndex = _OldIndex
Else
MyBase.OnSelectedIndexChanged(e)
End If
End Sub
End Class
Page generated in 1,714,017,198.11287 seconds with 10 queries