|
-
Sep 5th, 2001, 04:22 AM
#1
Thread Starter
New Member
UserControl and its properties
Hello,
I'm creating an usercontrol. Now i want to create some properties for it, and i'm wondering if the following can be accomplished:
usercontrol.props.add()
I can create it like this:
usercontrol.add()
This is what i have as code:
Code:
Public type item
prop1 as string
prop2 as string
end type
public property get test() as item
'code
end property
public property let test(vNewValue as item)
'code
end property
Public sub Add()
'code
end sub
Can anyone tell me, what i have to do to make the sub Add() as a property of Item??
Thanx,
Barry
-
Sep 5th, 2001, 04:39 AM
#2
Fanatic Member
You would use the same syntax as for your test Property to create another Proprety.
I don't know anyway to create something like usercontrol.props.add().
I'd just set your strings in a Property.
If you add public Subs/Functions, then these are like methods for your control.
-
Sep 5th, 2001, 05:45 AM
#3
Thread Starter
New Member
Can you give me some more info please? i don't what you mean.
Barry
-
Sep 5th, 2001, 05:56 AM
#4
Fanatic Member
At the top of the code, define prop1 to be modular variable:
VB Code:
Private m_prop1 As String
to set prop1:
VB Code:
public property let Prop1(vNewValue as String)
m_prop1 = vNewValue
end property
So prop1 is read-only, if you want it to be read/write then add:
Code:
public property get Prop1() as String
Prop1 = m_prop1
end property
I like paraffin by the way!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|