Results 1 to 6 of 6

Thread: User Control Help with Constant

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2011
    Posts
    6

    User Control Help with Constant

    I am making my own customized Listbox. I am trying to include all the features of the listbox, such as Selected. However when my code in the application i am making the UserControl for, tries to set the List.Selected(Num) = False, I get an error "Assignment to a constant not permitted". Here is the code i have in the user control. What do i need to change or add to make it settable as well as readable?

    Public Function Selected(Num As Integer) As Boolean
    Selected = List1.Selected(Num)
    End Function

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: User Control Help with Constant

    Try this
    vb Code:
    1. Public Property Get Selected(ByVal Index As Integer) As Boolean
    2.     Selected = List1.Selected(Index)
    3. End Property
    4.  
    5. Public Property Let Selected(ByVal Index As Integer, ByVal New_Selected As Boolean)
    6.     List1.Selected(Index) = New_Selected
    7.     PropertyChanged "Selected"
    8. End Property



  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2011
    Posts
    6

    Re: User Control Help with Constant

    works perfectly thank you

  4. #4
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: User Control Help with Constant

    Quote Originally Posted by joelstoner View Post
    works perfectly thank you
    Don't forget to read the first line of my signature



  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2011
    Posts
    6

    Re: User Control Help with Constant

    Quote Originally Posted by 4x2y View Post
    Don't forget to read the first line of my signature
    Good thing you posted that, i didn't even know there was a rating system.

  6. #6
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: User Control Help with Constant

    Quote Originally Posted by joelstoner View Post
    Good thing you posted that, i didn't even know there was a rating system.
    Thanks, i got it



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