473,834 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Yes/No ComboBox

I have a need to have a combo box that just has Yes & No as it options.
This will be used everywhere in the application, so I thought I would
make a control that inherits from combobox. I am having trouble
figuring out how to add the Y/N in control. I tried:
Public Class YesNoCombobox
Inherits ComboBox
Sub New()
MyBase.New()
If Me.Items.Count = 0 Then
Me.Items.Add("N - No")
Me.Items.Add("Y - Yes")
End If
End Sub
End Class

This doubles the N/Y because the designer places a N/Y in the designer
code as well. Anyone have thoughts on how to do this?

Chris
Jun 22 '06 #1
14 4812
If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?

Using a ComboBox for this, I would say, is a good example of a poorly
designed UI. UI's should be easy to use and understand for users. Users
don't expect ComboBoxes for Y & N answers.

Is there some reason why you feel you need a ComboBox for this?

"Chris" <no@spam.com> wrote in message
news:eo******** ******@TK2MSFTN GP03.phx.gbl...
I have a need to have a combo box that just has Yes & No as it options.
This will be used everywhere in the application, so I thought I would make
a control that inherits from combobox. I am having trouble figuring out
how to add the Y/N in control. I tried:
Public Class YesNoCombobox
Inherits ComboBox
Sub New()
MyBase.New()
If Me.Items.Count = 0 Then
Me.Items.Add("N - No")
Me.Items.Add("Y - Yes")
End If
End Sub
End Class

This doubles the N/Y because the designer places a N/Y in the designer
code as well. Anyone have thoughts on how to do this?

Chris

Jun 22 '06 #2
Scott M. wrote:
If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?

Using a ComboBox for this, I would say, is a good example of a poorly
designed UI. UI's should be easy to use and understand for users. Users
don't expect ComboBoxes for Y & N answers.

Is there some reason why you feel you need a ComboBox for this?

"Chris" <no@spam.com> wrote in message
news:eo******** ******@TK2MSFTN GP03.phx.gbl...
I have a need to have a combo box that just has Yes & No as it options.
This will be used everywhere in the application, so I thought I would make
a control that inherits from combobox. I am having trouble figuring out
how to add the Y/N in control. I tried:
Public Class YesNoCombobox
Inherits ComboBox
Sub New()
MyBase.New()
If Me.Items.Count = 0 Then
Me.Items.Add("N - No")
Me.Items.Add("Y - Yes")
End If
End Sub
End Class

This doubles the N/Y because the designer places a N/Y in the designer
code as well. Anyone have thoughts on how to do this?

Chris



Yes, thank you for your concern on my design, but we are duplicating a
functionality that already exists. They like the way it is and it is
not worth fighting to change it. It works well and it I still would
like a solution.

Chris
Jun 22 '06 #3
"Scott M." <s-***@nospam.nosp am> schrieb:
If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?


I'd use a checkbox control ("boolean control") :-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jun 22 '06 #4
At the end it is what the customer wants. If they like it a combo box
it must be a combobox :)

Chris try the follwoing:

Protected Overrides Sub InitLayout()
MyBase.InitLayo ut()

If Me.Items.Count = 0 Then
Me.Items.Add("Y es")
Me.Items.Add("N o")
End If
End Sub

It worked for me.

Cheers,

Ahmed
Chris wrote:
Scott M. wrote:
If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?

Using a ComboBox for this, I would say, is a good example of a poorly
designed UI. UI's should be easy to use and understand for users. Users
don't expect ComboBoxes for Y & N answers.

Is there some reason why you feel you need a ComboBox for this?

"Chris" <no@spam.com> wrote in message
news:eo******** ******@TK2MSFTN GP03.phx.gbl...
I have a need to have a combo box that just has Yes & No as it options.
This will be used everywhere in the application, so I thought I would make
a control that inherits from combobox. I am having trouble figuring out
how to add the Y/N in control. I tried:
Public Class YesNoCombobox
Inherits ComboBox
Sub New()
MyBase.New()
If Me.Items.Count = 0 Then
Me.Items.Add("N - No")
Me.Items.Add("Y - Yes")
End If
End Sub
End Class

This doubles the N/Y because the designer places a N/Y in the designer
code as well. Anyone have thoughts on how to do this?

Chris



Yes, thank you for your concern on my design, but we are duplicating a
functionality that already exists. They like the way it is and it is
not worth fighting to change it. It works well and it I still would
like a solution.

Chris


Jun 23 '06 #5
Ahmed,

At the end it is what the customer tells when they have chosen another shop.

By instance that those had a more from this time solution with an easier way
of handling by instance the UI commands, which saved them a lot of time.

Just my thought reading your message.

Cor

"Ahmed" <ah*******@gmai l.com> schreef in bericht
news:11******** **************@ r2g2000cwb.goog legroups.com...
At the end it is what the customer wants. If they like it a combo box
it must be a combobox :)

Chris try the follwoing:

Protected Overrides Sub InitLayout()
MyBase.InitLayo ut()

If Me.Items.Count = 0 Then
Me.Items.Add("Y es")
Me.Items.Add("N o")
End If
End Sub

It worked for me.

Cheers,

Ahmed
Chris wrote:
Scott M. wrote:
> If it needs only Y & N, shouldn't it be a boolean control or a listbox
> control, but not a ComboBox control?
>
> Using a ComboBox for this, I would say, is a good example of a poorly
> designed UI. UI's should be easy to use and understand for users.
> Users
> don't expect ComboBoxes for Y & N answers.
>
> Is there some reason why you feel you need a ComboBox for this?
>
> "Chris" <no@spam.com> wrote in message
> news:eo******** ******@TK2MSFTN GP03.phx.gbl...
>> I have a need to have a combo box that just has Yes & No as it
>> options.
>> This will be used everywhere in the application, so I thought I would
>> make
>> a control that inherits from combobox. I am having trouble figuring
>> out
>> how to add the Y/N in control. I tried:
>>
>>
>> Public Class YesNoCombobox
>> Inherits ComboBox
>> Sub New()
>> MyBase.New()
>> If Me.Items.Count = 0 Then
>> Me.Items.Add("N - No")
>> Me.Items.Add("Y - Yes")
>> End If
>> End Sub
>> End Class
>>
>> This doubles the N/Y because the designer places a N/Y in the designer
>> code as well. Anyone have thoughts on how to do this?
>>
>> Chris
>
>


Yes, thank you for your concern on my design, but we are duplicating a
functionality that already exists. They like the way it is and it is
not worth fighting to change it. It works well and it I still would
like a solution.

Chris

Jun 23 '06 #6
I guess you will be losing many customers :P

when it comes to creating programs in house and dealing with
non-technical personnel it becomes even worse.
Cor Ligthert [MVP] wrote:
Ahmed,

At the end it is what the customer tells when they have chosen another shop.

By instance that those had a more from this time solution with an easier way
of handling by instance the UI commands, which saved them a lot of time.

Just my thought reading your message.

Cor

"Ahmed" <ah*******@gmai l.com> schreef in bericht
news:11******** **************@ r2g2000cwb.goog legroups.com...
At the end it is what the customer wants. If they like it a combo box
it must be a combobox :)

Chris try the follwoing:

Protected Overrides Sub InitLayout()
MyBase.InitLayo ut()

If Me.Items.Count = 0 Then
Me.Items.Add("Y es")
Me.Items.Add("N o")
End If
End Sub

It worked for me.

Cheers,

Ahmed
Chris wrote:
Scott M. wrote:
> If it needs only Y & N, shouldn't it be a boolean control or a listbox
> control, but not a ComboBox control?
>
> Using a ComboBox for this, I would say, is a good example of a poorly
> designed UI. UI's should be easy to use and understand for users.
> Users
> don't expect ComboBoxes for Y & N answers.
>
> Is there some reason why you feel you need a ComboBox for this?
>
> "Chris" <no@spam.com> wrote in message
> news:eo******** ******@TK2MSFTN GP03.phx.gbl...
>> I have a need to have a combo box that just has Yes & No as it
>> options.
>> This will be used everywhere in the application, so I thought I would
>> make
>> a control that inherits from combobox. I am having trouble figuring
>> out
>> how to add the Y/N in control. I tried:
>>
>>
>> Public Class YesNoCombobox
>> Inherits ComboBox
>> Sub New()
>> MyBase.New()
>> If Me.Items.Count = 0 Then
>> Me.Items.Add("N - No")
>> Me.Items.Add("Y - Yes")
>> End If
>> End Sub
>> End Class
>>
>> This doubles the N/Y because the designer places a N/Y in the designer
>> code as well. Anyone have thoughts on how to do this?
>>
>> Chris
>
>

Yes, thank you for your concern on my design, but we are duplicating a
functionality that already exists. They like the way it is and it is
not worth fighting to change it. It works well and it I still would
like a solution.

Chris


Jun 23 '06 #7

Even MS doesn't follow this suggestion. Take a look at the properties page
for various controls (text edit for example) and you will see multiple
instances of properties marked Yes/No or True/False that are combo boxes and
not checkboxes.

Mike Ober.

"Scott M." <s-***@nospam.nosp am> wrote in message
news:up******** ******@TK2MSFTN GP05.phx.gbl...

If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?

Using a ComboBox for this, I would say, is a good example of a poorly
designed UI. UI's should be easy to use and understand for users. Users
don't expect ComboBoxes for Y & N answers.

Is there some reason why you feel you need a ComboBox for this?

"Chris" <no@spam.com> wrote in message
news:eo******** ******@TK2MSFTN GP03.phx.gbl...
I have a need to have a combo box that just has Yes & No as it options.
This will be used everywhere in the application, so I thought I would makea control that inherits from combobox. I am having trouble figuring out
how to add the Y/N in control. I tried:
Public Class YesNoCombobox
Inherits ComboBox
Sub New()
MyBase.New()
If Me.Items.Count = 0 Then
Me.Items.Add("N - No")
Me.Items.Add("Y - Yes")
End If
End Sub
End Class

This doubles the N/Y because the designer places a N/Y in the designer
code as well. Anyone have thoughts on how to do this?

Chris



Jun 23 '06 #8
I tend to you comboboxes for "yes/no" where I need to record the third state
(ie unselected). Sometimes in a form, I want the user to specifically make
a choice, rather than perhaps forget and take the default. I find the
combobox better than the checkbox for this purpose.

Having said that the checkbox is more the norm. for yes/no true/false
boolean tests.

Simon

--
=============== =============== ==
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011

"Michael D. Ober" <obermd.@.alum. mit.edu.nospam> wrote in message
news:O4******** ******@TK2MSFTN GP02.phx.gbl...

Even MS doesn't follow this suggestion. Take a look at the properties
page
for various controls (text edit for example) and you will see multiple
instances of properties marked Yes/No or True/False that are combo boxes
and
not checkboxes.

Mike Ober.

"Scott M." <s-***@nospam.nosp am> wrote in message
news:up******** ******@TK2MSFTN GP05.phx.gbl...

If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?

Using a ComboBox for this, I would say, is a good example of a poorly
designed UI. UI's should be easy to use and understand for users. Users
don't expect ComboBoxes for Y & N answers.

Is there some reason why you feel you need a ComboBox for this?

"Chris" <no@spam.com> wrote in message
news:eo******** ******@TK2MSFTN GP03.phx.gbl...
>I have a need to have a combo box that just has Yes & No as it options.
>This will be used everywhere in the application, so I thought I would make >a control that inherits from combobox. I am having trouble figuring out
>how to add the Y/N in control. I tried:
>
>
> Public Class YesNoCombobox
> Inherits ComboBox
> Sub New()
> MyBase.New()
> If Me.Items.Count = 0 Then
> Me.Items.Add("N - No")
> Me.Items.Add("Y - Yes")
> End If
> End Sub
> End Class
>
> This doubles the N/Y because the designer places a N/Y in the designer
> code as well. Anyone have thoughts on how to do this?
>
> Chris



Jun 23 '06 #9
Michael,

Do you use Version 2003, if you have ever opened an "add reference dialog
box", you would never write anymore than *even*. However there has been a
suggestion to do that better and the boxes in the VBNet windowsform IDE
version 2005 are now completely resizable.

To say it in other words, it are just normal developers who make the same
mistakes as you and me, but change things when there is put their attention
on it..

Just my thought,

Cor
"Michael D. Ober" <obermd.@.alum. mit.edu.nospam> schreef in bericht
news:O4******** ******@TK2MSFTN GP02.phx.gbl...

Even MS doesn't follow this suggestion. Take a look at the properties
page
for various controls (text edit for example) and you will see multiple
instances of properties marked Yes/No or True/False that are combo boxes
and
not checkboxes.

Mike Ober.

"Scott M." <s-***@nospam.nosp am> wrote in message
news:up******** ******@TK2MSFTN GP05.phx.gbl...

If it needs only Y & N, shouldn't it be a boolean control or a listbox
control, but not a ComboBox control?

Using a ComboBox for this, I would say, is a good example of a poorly
designed UI. UI's should be easy to use and understand for users. Users
don't expect ComboBoxes for Y & N answers.

Is there some reason why you feel you need a ComboBox for this?

"Chris" <no@spam.com> wrote in message
news:eo******** ******@TK2MSFTN GP03.phx.gbl...
>I have a need to have a combo box that just has Yes & No as it options.
>This will be used everywhere in the application, so I thought I would make >a control that inherits from combobox. I am having trouble figuring out
>how to add the Y/N in control. I tried:
>
>
> Public Class YesNoCombobox
> Inherits ComboBox
> Sub New()
> MyBase.New()
> If Me.Items.Count = 0 Then
> Me.Items.Add("N - No")
> Me.Items.Add("Y - Yes")
> End If
> End Sub
> End Class
>
> This doubles the N/Y because the designer places a N/Y in the designer
> code as well. Anyone have thoughts on how to do this?
>
> Chris



Jun 23 '06 #10

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

Similar topics

7
8543
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 of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products purchased by a customer, both Active and Inactive in a ComboBox, cbProducts. My client wants to view all...
8
12121
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 combobox. What is the solution? Thank you in advance.
1
2502
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 DataTable("table"); testTable.Columns.Add("Col1", typeof(Int32)); testTable.Columns.Add("Col2", typeof(String)); testTable.Rows.Add(testTable.NewRow());
3
6838
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: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
6
2885
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 and the coresponding 'Id' from the lookup table is to be inserted into the field of the new record. I have two simple tables. "tblPerson" is the data table. The lookup
0
9799
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10793
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10548
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7758
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5794
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4427
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 we have to send another system
2
3978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.