473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 4763
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**************@TK2MSFTNGP03.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**************@TK2MSFTNGP03.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.nospam> 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.InitLayout()

If Me.Items.Count = 0 Then
Me.Items.Add("Yes")
Me.Items.Add("No")
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**************@TK2MSFTNGP03.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*******@gmail.com> schreef in bericht
news:11**********************@r2g2000cwb.googlegro ups.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.InitLayout()

If Me.Items.Count = 0 Then
Me.Items.Add("Yes")
Me.Items.Add("No")
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**************@TK2MSFTNGP03.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*******@gmail.com> schreef in bericht
news:11**********************@r2g2000cwb.googlegro ups.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.InitLayout()

If Me.Items.Count = 0 Then
Me.Items.Add("Yes")
Me.Items.Add("No")
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**************@TK2MSFTNGP03.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.nospam> wrote in message
news:up**************@TK2MSFTNGP05.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**************@TK2MSFTNGP03.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**************@TK2MSFTNGP02.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.nospam> wrote in message
news:up**************@TK2MSFTNGP05.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**************@TK2MSFTNGP03.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**************@TK2MSFTNGP02.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.nospam> wrote in message
news:up**************@TK2MSFTNGP05.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**************@TK2MSFTNGP03.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
Hello Chris,

All this talk of checkboxes.. For purely Yes/No selections (for which Yes
is mutually exclusive of No) radiobuttons are the correct control. If the
user can select both Yes and No, then three radiobuttons (Yes, No, Mabey)
is better. Perhaps ya'll were thinking of a single checkbox.. which would
work as well.. but it doesn't convey the same Yes/No UI option that a Y/N
combobox would.

-Boo
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 #11
"GhostInAK" <gh*******@gmail.com> schrieb:
All this talk of checkboxes.. For purely Yes/No selections (for which Yes
is mutually exclusive of No) radiobuttons are the correct control.


How do you come to this perception?!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 23 '06 #12
Yes, but those listboxes are nested within a larger context. To say that
even MS doesn't follow this suggestion is incorrect.
"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:O4**************@TK2MSFTNGP02.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.nospam> wrote in message
news:up**************@TK2MSFTNGP05.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**************@TK2MSFTNGP03.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 #13
When I pay my bills online, I am forced to check a single checkbox,
indicating that "Yes", I have read and agree to the terms and conditions of
that web site. If I don't check the checkbox, it means that "No", I don't.

The single checkbox solution is just as valid as the Yes & No radiobutton
solution.

All I suggested was that a "Boolean" control would be best. Both checkboxes
and radiobuttons are Boolean.
"GhostInAK" <gh*******@gmail.com> wrote in message
news:be*************************@news.microsoft.co m...
Hello Chris,

All this talk of checkboxes.. For purely Yes/No selections (for which Yes
is mutually exclusive of No) radiobuttons are the correct control. If the
user can select both Yes and No, then three radiobuttons (Yes, No, Mabey)
is better. Perhaps ya'll were thinking of a single checkbox.. which would
work as well.. but it doesn't convey the same Yes/No UI option that a Y/N
combobox would.

-Boo
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 #14
Hello GhostInAK,

My appologies. I meant in the context of providing both Yes and No as UI
elements (as the combobox would have done).

Some days I forget to type a letter.. some days I gotget to type a word..
other days I forget to type whole paragraphs.

-Boo
Hello Chris,

All this talk of checkboxes.. For purely Yes/No selections (for which
Yes is mutually exclusive of No) radiobuttons are the correct control.
If the user can select both Yes and No, then three radiobuttons (Yes,
No, Mabey) is better. Perhaps ya'll were thinking of a single
checkbox.. which would work as well.. but it doesn't convey the same
Yes/No UI option that a Y/N combobox would.

-Boo
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 #15

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

Similar topics

7
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
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
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
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:...
6
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.