Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 19-03-2009
Member
 
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
Reply With Quote
  #2  
Old 19-03-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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.
Reply With Quote
  #3  
Old 19-03-2009
Member
 
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
Reply With Quote
  #4  
Old 19-03-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to lock combobox"
Thread Thread Starter Forum Replies Last Post
Need Help With ComboBox Reyas Software Development 1 29-04-2012 12:53 PM
Use of combobox in script Martien Software Development 3 15-01-2010 11:58 AM
Combobox and Text value HarshaB Software Development 5 09-11-2009 07:16 PM
Using a variable from Flash combobox Hashim Software Development 3 06-10-2009 10:39 PM
Add ComboBox in DataGrid in VB 6.0 Jateen Software Development 3 15-01-2009 06:31 PM


All times are GMT +5.5. The time now is 12:41 AM.