Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
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
Updated 3-Apr-17 15:03pm
Comments
[no name] 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 ...

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.
 
Share this answer
 
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
'*********************************************************************
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900