Results 1 to 23 of 23

Thread: Problem CheckedListBox

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Problem CheckedListBox

    Hello,

    So my problem is this. I am inspired by a code on another site, but I understand that. The problem is in this code, to manage a list, the code uses the ListBox, but the disadvantage is that you can select only one box, or I need to select multiple CheckedListBox so I replaced, I am is perfect, BUT I can not update the code. These are the two errors obtained:


    Error: "
    Code:
    Error 3 'Items'is not a member of 'System.Windows.Forms.GroupBox'.
    Error 2 'SelectedItem'is not a member of 'System.Windows.Forms.GroupBox'.
    Here is the corresponding source code (an example is because there are more lines in the same genre):

    Code:
    Code:
    Me.list_cc.Items.Clear()
    Me.list_cc.SelectedItem
    How can I get the same effect as 2 functions with CheckedListBox? Many thank you

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    list_cc is obviously your groupbox + not your CheckedListBox
    use the right name + it'll work

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Thanks but have you a example , i don't understand

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    it's basic beginners vb. if you don't understand you should try a tutorial first:

    http://www.homeandlearn.co.uk/NET/vbNet.html

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Yes but my CheckedListBox's name is list_cc . And i want a fonction in CheckedListBox = Items or SelectedItem'

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    i can't give you an example because it really isn't clear what you're trying to do.
    if you want to upload your project i'll have a look

  7. #7

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Yes i want a example please . It's clear but i don't see how do .

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    please read post #6 again

    i said i can't give you an example

  9. #9

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Sorry but for my code :
    vb Code:
    1. Me.list_cc.SelectedItem

    How i can do now ?

  10. #10
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    ok post your full code

  11. #11

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    This is my code for error error 'SelectedItem' :

    VB Code:
    1. If Not Me.list_cc.SelectedItem Is Nothing Then
    2.             'Retrouve le film avec ce nom
    3.             For Each ccALister As ccinfo In _Listecc
    4.                 If ccALister.Nom = Me.list_cc.SelectedItem.ToString Then
    5.                     'L'insère dans une variable globale
    6.                     Me._ccEnVisualisation = ccALister
    7.                 End If
    8.             Next
    9.         End If

    This is my code for error error 'Item' :
    Vb Code:
    1. Me.list_cc.Items.Clear()

    My code is too long for post

  12. #12
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    i think we have a language barrier.
    we need to see the relevant code if you have any chance of help + if it's all in french, i probably won't be able to help you

  13. #13

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Code in english :

    Vb Code:
    1. If Not Me.list_cc.SelectedItem Is Nothing Then
    2.             'Found the movie with that name
    3.             For Each ccALister As ccinfo In _Listecc
    4.                 If ccALister.Nom = Me.list_cc.SelectedItem.ToString Then
    5.                     'Inserts in a global variable
    6.                     Me._ccEnVisualisation = ccALister
    7.                 End If
    8.             Next
    9.         End If

  14. #14
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    that isn't the relevant code

    we need to see the lines that are causing the errors

  15. #15
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    also if vb says list_cc is a groupbox it probably is a groupbox

  16. #16

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    It's the only code for error SelectedItem
    Vb Code:
    1. If Not Me.list_cc.SelectedItem Is Nothing Then
    2.             'Found the movie with that name
    3.             For Each ccALister As ccinfo In _Listecc
    4.                 If ccALister.Nom = Me.list_cc.SelectedItem.ToString Then
    5.                     'Inserts in a global variable
    6.                     Me._ccEnVisualisation = ccALister
    7.                 End If
    8.             Next
    9.         End If

    The rest is much too long for post . If you explain me the error , i can solve
    the error for the rest of the code

  17. #17
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    in your form designer, click on the list_cc listbox(???) + take a screenshot that shows the selected listbox + the properties window + post it in this thread

  18. #18
    Hyperactive Member Ram2Curious's Avatar
    Join Date
    Apr 2010
    Posts
    484

    Re: Problem CheckedListBox

    Like paul said, unless you debug the code and locate the error, we won't be able to know the cause of error. You have something like " .Nom " in your code. What is it ?

  19. #19

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Forget it, thank you but it's too complicated .. By cons how do I select all the boxes. I have this function but it does to selection:

    CheckedListBox1.SetItemChecked (0, True)

    Seconde question, I have fichier.vb [Design] but i have delet onglet , how I can to re-open this ?

  20. #20
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    i take it you solved the list_cc problem then?

    vb Code:
    1. For x As Integer = 0 To CheckedListBox1.Items.Count - 1
    2.     CheckedListBox1.SetItemChecked(x, True)
    3. Next

    Quote Originally Posted by max1395 View Post
    Seconde question, I have fichier.vb [Design] but i have delet onglet , how I can to re-open this ?
    what's that in english?

  21. #21

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    I had a tab Fichier.vb [Design]. But without express I cancel tab, how to restore?

  22. #22
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Problem CheckedListBox

    in your designer you have a project explorer window on the right. doubleclick Fichier.vb

  23. #23

    Thread Starter
    Member
    Join Date
    Apr 2011
    Posts
    32

    Re: Problem CheckedListBox

    Yes of course ^^ Thanks you . Sorry for my bad english .

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