Click here to Skip to main content
13,732,072 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Posted 3-Apr-17 9:13am
Updated 3-Apr-17 15:03pm
Comments
NotPolitcallyCorrect 3-Apr-17 15:35pm
   
8 checkboxes and only 1 boolean result? I suspect that you are using the wrong control for whatever it is that you are doing.
Ralf Meier 4-Apr-17 3:10am
   
What are you trying to achieve ?
When do you want to get a 'Yes'-Result from your 8 Checkboxes ?
Perhaps you give an example ...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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
'*********************************************************************
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180920.1 | Last Updated 3 Apr 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100