Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using a checklistbox so a user can make multiple selection but the selection mode cant be set to multiple, i have to go through the hustles of writing codes for checkboxes which is working though but i still want to know if theres anyway i can use checklistbox to accomplish that...could anyone help me
thanks...the following is codes i tried out

VB
Dim checker As String
    Dim check1 As String
    Dim check2 As String
    Dim check3 As String
    Dim check4 As String

        If CheckBox1.Checked = True Then
            check1 = CheckBox1.Text
        ElseIf CheckBox1.Checked = False Then
            check1 = ""
        End If

        If CheckBox2.Checked = True Then
            check2 = CheckBox2.Text
        ElseIf CheckBox2.Checked = False Then
            check2 = ""
        End If

        If CheckBox3.Checked = True Then
            check3 = CheckBox3.Text
        ElseIf CheckBox3.Checked = False Then
            check3 = ""
        End If

        If CheckBox4.Checked = True Then
            check4 = CheckBox4.Text
        ElseIf CheckBox4.Checked = False Then
            check4 = ""
        End If

checker = check1 + " " + check2 + " " + check3 + " " + check4

This is just a few of the checkboxes...
I want to store the text of checked boxes in a variable 'checker' but when checkbox1 is not checked there seems to be space before other text. I want to get rid of that space in case checkbox1 is not checked. I hope this is clear enough.
Posted
Updated 3-Nov-12 4:51am
v4
Comments
joshrduncan2012 1-Nov-12 10:11am    
Can you show us your code and what output you are getting right now? We can't guess as to what you are doing if you don't provide code.
Nelek 1-Nov-12 10:15am    
How are we supposed to help you? You don't post any code, you just say "I don't get expected result". I thought this was a place for programmers, but you are expecting X-Files help. We can not read minds, we can not make astral travels to see your monitor...

I strongly recommend you to carefully read:
what have you tried?[^]
How to ask a question?[^]

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