Results 1 to 4 of 4

Thread: [RESOLVED] Checkboxes Caption Display in string

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    73

    Resolved [RESOLVED] Checkboxes Caption Display in string

    hi all,
    supposely, i have 10 checkboxes in VB. user can check any number of checkboxes. i like to display the caption of the checked checkboxes with semi-colon ( in between each caption in a single string or messagebox. how to i do it? can someone help me with the codes?

    longwar
    Last edited by Hack; May 15th, 2006 at 07:27 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: Checkboxes Caption Display in string

    Private Sub Check1_Click()
    MsgBox "'" + Check1.Caption + "'", vbInformation
    End Sub

  3. #3
    Addicted Member
    Join Date
    Apr 2006
    Posts
    155

    Re: Checkboxes Caption Display in string

    To make this easier make all your checkboxes the same name with a index 0 to 9. Goto your properties window to do this.

    VB Code:
    1. Dim i As Integer
    2. Dim str As String
    3.  For i% = 0 to 9 'or 1 to 10
    4.   If chk(i%).Value = 1 Then 'value is true
    5.     str$ = str$ & " ; " & chk(i%).Caption
    6.   End If
    7.  Next i%
    8.     Me.Caption = str$

    Put this code in the Checkbox

    I don't know if this is what you meant, but I hope it is.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    73

    Re: Checkboxes Caption Display in string

    thks XRsTX. u got what i mean. thks alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width