Results 1 to 4 of 4

Thread: How to lock combobox

  1. #1
    Join Date
    Jan 2009
    Posts
    126

    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

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    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.

  3. #3
    Join Date
    Jan 2009
    Posts
    126

    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

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    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

Similar Threads

  1. Need Help With ComboBox
    By Reyas in forum Software Development
    Replies: 1
    Last Post: 29-04-2012, 12:53 PM
  2. Use of combobox in script
    By Martien in forum Software Development
    Replies: 3
    Last Post: 15-01-2010, 11:58 AM
  3. Combobox and Text value
    By HarshaB in forum Software Development
    Replies: 5
    Last Post: 09-11-2009, 07:16 PM
  4. Using a variable from Flash combobox
    By Hashim in forum Software Development
    Replies: 3
    Last Post: 06-10-2009, 10:39 PM
  5. Add ComboBox in DataGrid in VB 6.0
    By Jateen in forum Software Development
    Replies: 3
    Last Post: 15-01-2009, 06:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,499,516.42156 seconds with 17 queries