473,511 Members | 17,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MyComboBox inherrited from ComboBox

Example:

public class MyComboBox : System.Windows.Forms.ComboBox;
{
public bool CanDropDown = true;

public MyComboBox()
{
}
}

Prease help me how modify this class for if CanDropDown = false, the user
can not open the drop down list of the combobox.
I do'nt want to use the Enabled propertie.

Thank you!
Nov 16 '05 #1
2 1975
instead of using a public variable, use a public property

private book _canDropDown;

public bool CanDropDown
{
get
{
return _canDropDown;
}

set
{
// Set the internal value
_canDropDown = value;

// If the internal value if false, disable the dropdown
if (_canDropDown == false)
{
this.Enabled = false;
}
else
{
this.Enabled = true;
}
}
}

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Mihaly" <Mi****@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Example:

public class MyComboBox : System.Windows.Forms.ComboBox;
{
public bool CanDropDown = true;

public MyComboBox()
{
}
}

Prease help me how modify this class for if CanDropDown = false, the user can not open the drop down list of the combobox.
I do'nt want to use the Enabled propertie.

Thank you!

Nov 16 '05 #2
I don't want to use the Enabled property. I want to let Enabled = true,
but to denide drop down the combobox's dropdown list.
I tried to override OnDropDown() protected methode, but it's not working.

Example:

protected override void OnDropDown()
{
if (this.CanDropDown)
base.OnDropDown();
}

Thank you!

"Manohar Kamath" wrote:
instead of using a public variable, use a public property

private book _canDropDown;

public bool CanDropDown
{
get
{
return _canDropDown;
}

set
{
// Set the internal value
_canDropDown = value;

// If the internal value if false, disable the dropdown
if (_canDropDown == false)
{
this.Enabled = false;
}
else
{
this.Enabled = true;
}
}
}

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Mihaly" <Mi****@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Example:

public class MyComboBox : System.Windows.Forms.ComboBox;
{
public bool CanDropDown = true;

public MyComboBox()
{
}
}

Prease help me how modify this class for if CanDropDown = false, the

user
can not open the drop down list of the combobox.
I do'nt want to use the Enabled propertie.

Thank you!


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2744
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
7
8485
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
8
12066
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
1
2478
by: anonymous | last post by:
I've been trying to put a them, please help me out. Here's the major parts of my code: public Form1() { DataSet myDataSet = new DataSet("myDataSet"); DataTable testTable = new...
3
3016
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
3
6805
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
6169
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
4
4602
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
6
2844
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.