如何排列复选框 [英] How to permutate check boxes

查看:110
本文介绍了如何排列复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个迷你系统。它是一个将传递复选框结果并生成结果的系统。我有8个复选框。只有两种可能的结果。我如何编码复选框以进行变异并给我或者是或否?

我还是初学程序员

我在视觉工作室基本编码12



我尝试了什么:



刚刚构建的ui系统并指向按钮

解决方案

您不编码复选框。你编写代码来获取复选框的状态并通过你正在谈论的任何算法来生成你正在寻找的价值。



既然你没有提到这个算法应该做什么来产生最终结果,不可能告诉你任何有用的东西。


你好会员13103467



目前还不是很清楚你想做什么。请提供解释问题的最小代码段。



根据您的说法,我了解您要浏览所有复选框并达到是/否类型基于对所选值的评估来回答。我假设您只想评估所选的复选框。



为简单起见,我使用的是 List 所有选中的复选框值。实际上,您可能不需要这个并自行处理所选的复选框值。



'************** ************************************************** *****

'此列表包含所选复选框的所有值(文本)。

Dim SelectedCheckBoxValues作为列表(字符串)=新列表(字符串) )



'假设复选框位于名为GroupBox1的组合框内

For Each Chkbox As CheckBox In GroupBox2.Controls

   如果Chkbox.Checked = True那么

       SelectedCheckBoxValues.Add(Chkbox.Text)

   结束如果

下一页



'流程 SelectedCheckBoxValues 使用你的算法。

'例如:

'对于每个Str作为字符串在SelectedCheckBoxValues

   'Process Str and输出是否

'下一页

'********************** ***************

I am building a mini system. Its a system that will pass checkbox results and generate a result. I have 8 check boxes. there are only two possible results. how do i code the check boxes to per mutate and give me either yes or no?
I'm still a beginner programmer
I'm coding in basic with visual studio 12

What I have tried:

just built the ui of the system and pointed the buttons

解决方案

You don't "code the check boxes". You write code to get the state of the checkboxes and go through whatever algorithm you're talking about to generate the value you're looking for.

Since you make no mention of what this algorithm is supposed to do to generate the end result, it's impossible to tell you anything useful.


Hi Member 13103467,

It is not quite clear what you want to do. Please provide minimum code snippet that explains the problem.

Based on what you say, I understand that you want to browse through all your checkboxes and attain to Yes/No type answer based on an evaluation of the selected values. I am assuming you want to evaluate only the selected checkboxes.

For simplicity I am using a List that holds all the selected checkbox values. In reality you might not need this and process the selected checkbox values on the fly on themselves.

'*********************************************************************
'This list holds all the values (texts) of the selected checkboxes.
Dim SelectedCheckBoxValues As List(Of String) = New List(Of String)

'Assuming that the checkboxes are inside a groupbox named GroupBox1
For Each Chkbox As CheckBox In GroupBox2.Controls
   If Chkbox.Checked = True Then
      SelectedCheckBoxValues.Add(Chkbox.Text)
   End If
Next

'Process SelectedCheckBoxValues with your algorithm.
'E.g.:
'For Each Str As String In SelectedCheckBoxValues
   'Process Str and output YesNo
'Next
'*********************************************************************


这篇关于如何排列复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆