Results 1 to 8 of 8

Thread: Custom Control Property

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2006
    Location
    Sheffield, UK
    Posts
    35

    Custom Control Property

    Hey, i have a Command Button Control that i have Created. I would like to know how to Add a Propertie so i can Add Text like the Normal Command Button. I've Searched loads of Places but not really got anywhere

    Cheers - L3mmy
    uhm, it wasn't me..

    Prove it..

    Prove it was me........

  2. #2
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: Custom Control Property

    ok i can help you build properties...
    heres the steps(for your case, but is these way that you will build a new propertyies):
    1-you must declare the variable in usercontrol Declaration section:
    Code:
    dim strCaption as string
    2-Lets create the property "Caption":
    Code:
    Public Property Get Caption() As string
         'here is for get the text
         Caption=strCaption
    End Property
    
    Public Property Let Caption(ByVal vNewValue As string)
        'here is for change the text
        strCaption=vnewvalue
        command1.caption=strCaption
        PropertyChanged "Caption" 
    End Property
    know you can put these property in property(for be persistent):
    Code:
    Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
         text=PropBag.ReadProperty("Caption", "")
    end sub
    
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
         PropBag.WriteProperty "Caption", Caption, ""
    end sub
    i hope help you...
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2006
    Location
    Sheffield, UK
    Posts
    35

    Re: Custom Control Property

    I Should probably say that i am doing this in Visual Basic 2005.

    Get/Set/Let are no Longer Supported

    L3mmy.
    uhm, it wasn't me..

    Prove it..

    Prove it was me........

  4. #4
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: Custom Control Property

    Quote Originally Posted by L3mmy
    I Should probably say that i am doing this in Visual Basic 2005.

    Get/Set/Let are no Longer Supported

    L3mmy.
    i'm sorry, but what version are you using?
    these code is for VB6, but if you need in VB2005 you can translate the code by using 1 option(i don't remenber the option name, i'm sorry)...
    i hope help...
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2006
    Location
    Sheffield, UK
    Posts
    35

    Re: Custom Control Property

    It's VB2005 Express..It's what i use to Develop my Apps for my Company.
    uhm, it wasn't me..

    Prove it..

    Prove it was me........

  6. #6
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: Custom Control Property

    Quote Originally Posted by L3mmy
    It's VB2005 Express..It's what i use to Develop my Apps for my Company.
    ok... but don't forget that you can translate my vb6 code by using an option for translate/update the code... i'm using visual basic 6, i'm new in visual basic 2005....
    stay well
    VB6 2D Sprite control

    To live is difficult, but we do it.

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2006
    Location
    Sheffield, UK
    Posts
    35

    Re: Custom Control Property

    No means to soind like a noob. But i havn't used this Function/Command. Where can i find it?

    - L3mmy
    uhm, it wasn't me..

    Prove it..

    Prove it was me........

  8. #8
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: Custom Control Property

    Quote Originally Posted by L3mmy
    No means to soind like a noob. But i havn't used this Function/Command. Where can i find it?

    - L3mmy
    "No means to soind like a noob."- i don't understand why you said these... i'm sorry, i'm portuguese...
    if i'm not round in Tools menu, go see if theres is something like "update vb6 code", something like these...
    tell me if i'm right...
    VB6 2D Sprite control

    To live is difficult, but we do 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