是/否ComboBox

编程入门 行业动态 更新时间:2024-10-07 02:26:34
本文介绍了是/否ComboBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要一个只有Yes&的组合框。不是它的选项。 这将在应用程序的任何地方使用,所以我想我会 制作一个继承自combobox的控件。我遇到了麻烦 搞清楚如何在控制中添加Y / N.我试过了: Public Class YesNoCombobox 继承ComboBox Sub New() MyBase.New() 如果Me.Items.Count = 0那么 Me.Items.Add(" N - No") Me.Items.Add (Y - 是) 结束如果 结束次级 结束班级 这使N / Y增加了一倍,因为设计师在设计师 代码中也设置了N / Y.有没有人想过如何做到这一点? 克里斯

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

推荐答案

如果它只需要Y& N,不应该是布尔控件或列表框 控件,而不是ComboBox控件吗? 使用ComboBox,我会比方说,这是一个很糟糕的设计用户界面的好例子。 UI'应该易于使用并且易于用户理解。用户 不要指望Y& ComboBoxes N回答。 你有什么理由认为你需要一个ComboBox吗? " Chris" < no@spam>在留言中写道 新闻:eo ************** @ TK2MSFTNGP03.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> wrote in message news:eo**************@TK2MSFTNGP03.phx.gbl... 我有需要有一个组合框,只有是和&不是它的选项。这将在应用程序的任何地方使用,所以我想我会使一个继承自组合框的控件。我无法搞清楚如何在控制中添加Y / N.我试过了: Public Class YesNoCombobox Inherits ComboBox Sub New() MyBase.New()如果Me.Items.Count = 0那么 Me.Items.Add(" N - No") Me.Items.Add(" Y - Yes")结束如果结束子结束类 这使N / Y加倍,因为设计师也将N / Y放在设计师的代码中。有没有人想过怎么做? Chris 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 outhow 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

Scott M.写道: Scott M. wrote: 如果它只需要Y& N,不应该是一个布尔控件或一个列表框控件,而不是一个ComboBox控件吗? 使用ComboBox这个,我想说,是一个很好的例子。设计不佳的用户界面。 UI'应该易于使用并且易于用户理解。用户不希望ComboBoxes为Y& N回答。 你有什么理由认为你需要一个ComboBox吗? Chris < no@spam>在消息中写道新闻:eo ************** @ TK2MSFTNGP03.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> wrote in message news:eo**************@TK2MSFTNGP03.phx.gbl... 我需要一个组合框只是有&不是它的选项。这将在应用程序的任何地方使用,所以我想我会使一个继承自组合框的控件。我无法搞清楚如何在控制中添加Y / N.我试过了: Public Class YesNoCombobox Inherits ComboBox Sub New() MyBase.New()如果Me.Items.Count = 0那么 Me.Items.Add(" N - No") Me.Items.Add(" Y - Yes")结束如果结束子结束类 这使N / Y加倍,因为设计师也将N / Y放在设计师的代码中。有没有人想过怎么做? Chris 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

是的,谢谢你的关注我的设计,但我们正在复制已经存在的 功能。他们喜欢它的样子,而且不值得为改变它而战斗。它运作良好,我仍然会像解决方案一样。 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

" Scott M. < S - *** @ nospam.nospam> schrieb: "Scott M." <s-***@nospam.nospam> schrieb: 如果它只需要Y& N,不应该是布尔控件或列表框控件,而不是ComboBox控件吗? If it needs only Y & N, shouldn''t it be a boolean control or a listbox control, but not a ComboBox control?

我会使用复选框控件(布尔控制):-)。 - MS Herfried K. Wagner MVP< URL :http://dotnet.mvps/> VB< URL:http://classicvb/petition/>

I''d use a checkbox control ("boolean control") :-). -- M S Herfried K. Wagner M V P <URL:dotnet.mvps/> V B <URL:classicvb/petition/>

更多推荐

是/否ComboBox

本文发布于:2023-11-28 03:11:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640737.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ComboBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!