multiple check combo box and get the result in textbox

basilyos

Registered User.
Local time
Today, 12:25
Joined
Jan 13, 2014
Messages
256
hello guys
I want to create a multiple check combo box then I want all the checked items in a textbox

for example If I check item1 - item2 - item5

in the textbox I want the result like this

--------------------------
|item1 - item2 - item5|
--------------------------

thanks in advance
 
you should rename all checkbox and its associated label, ie:
chkBox1, chkBox2, chkBox3, chkBox4....

and its associated label:

lblLabel1, lblLabel2, lblLabel3, lblLabe4....

now on on the Click Event of each checkbox control:
Private Sub chkBox1_Click()
ConcatLabel
End Sub

Private Sub chkBox2_Click()
ConcatLabel
End Sub

Private Sub chkBox3_Click()
ConcatLabel
End Sub

....and so on....

Private Sub ConcatLabel
Dim i As Integer
Dim strString as String
For i = 1 to howManyCheckBoxYouHave
strString = IIF(Me.Controls("chkBox" & i), Me.Controls("lblLabel" & i).Caption & " - ", "")
Next
if Len(strString)>0 then strString = Left(strString, LEN(strString)-3)
Me.yourTextBox.Value = strString
End Sub
 
thank you so much sir I'll try it right now
 
arnelgp i make what you tell me to do but nothing happen when i click on checkboxes


i put 20 checkboxex and i rename chkBox1 --> 20 and label lblLabel1 --> 20

and i put the textbox

nothing happened

any help sir

and what if i want to choose the items from a combo box???
 
Can you show us what you have done ? That way we can see if something is wrong with the function.
 
Private Sub ConcatLabel()
Dim i As Integer
Dim strString As String
For i = 1 To howManyCheckBoxYouHave
strString = IIf(Me.Controls("chkBox" & i), Me.Controls("lblLabel" & i).Caption & " - ", "")
Next
If Len(strString) > 0 Then strString = Left(strString, Len(strString) - 3)
Me.video_genre.Value = strString
End Sub

Private Sub chkBox1_Click()
ConcatLabel
End Sub

Private Sub chkBox2_Click()
ConcatLabel
End Sub

Private Sub chkBox3_Click()
ConcatLabel
End Sub

Private Sub chkBox4_Click()
ConcatLabel
End Sub
 
Try to change the "howManyCheckBoxYouHave" with the number of checkboxes you have.Then try again.
 

Users who are viewing this thread

Back
Top Bottom