|
-
Oct 26th, 2002, 12:59 PM
#1
Thread Starter
Need-a-life Member
Using Objects
Using Objects in UserControls
Is there any way to let the user interact with an object in it?
Last edited by Mc Brain; Oct 26th, 2002 at 01:06 PM.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:24 PM
#2
Could you explain a little more?
You can allow access to private objects through a property if that is what you mean...
VB Code:
Public Property Get SomeObject() As SomeObject
Set SomeObject = mSomeObject
End Property
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 26th, 2002, 01:25 PM
#3
Thread Starter
Need-a-life Member
I mean something like this:
VB Code:
Public Function TV() As TreeView
Set TV = TreeView
End Function
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:27 PM
#4
I don't know if it works the same way with functions vs properties, I would use a property. It should allow that.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 26th, 2002, 01:29 PM
#5
Thread Starter
Need-a-life Member
I'd tried your code as well... but didn't work.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:29 PM
#6
What happens? Can you supply the code?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 26th, 2002, 01:30 PM
#7
PowerPoster
All you have to do is create an instance of the object in your class and return a ref to the calling code. I would use a property get.
-
Oct 26th, 2002, 01:32 PM
#8
Thread Starter
Need-a-life Member
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:
Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members, or as fields of public user defined types
---------------------------
Aceptar Ayuda
---------------------------
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:33 PM
#9
Thread Starter
Need-a-life Member
Originally posted by Lethal
All you have to do is create an instance of the object in your class and return a ref to the calling code. I would use a property get.
How would you do that?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:35 PM
#10
Originally posted by Mc Brain
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:
Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members, or as fields of public user defined types
---------------------------
Aceptar Ayuda
---------------------------
Are you using an actual Treeview, or something of your own? If its your own class, then set the Instancing property to 5 MultiUse and it should work.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 26th, 2002, 01:36 PM
#11
Thread Starter
Need-a-life Member
I'm using a TreeView, and would like to let the user access their methods and properties without any coding.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:38 PM
#12
PowerPoster
Here's an example:
Code:
Option Explicit
Public Name As String
Public Property Get Clone() As MyObject
Dim clsClone As New MyObject
clsClone.Name = Me.Name
Set Clone = clsClone
End Property
-
Oct 26th, 2002, 01:39 PM
#13
Thread Starter
Need-a-life Member
I don't think that would let me do what I'm after....
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:41 PM
#14
Originally posted by Mc Brain
I'm using a TreeView, and would like to let the user access their methods and properties without any coding.
Well, then its a bit tricky, you'll need to make the property type an Object, then to get the intellisense and all that, you can set a treeview variable to the property
VB Code:
'In the Usercontrol
Public Property Get TV() As Object
Set TV = Treeview1
End Property
'On a form
Private Sub Command1_Click()
Dim tvw as Treeeview 'Only need for intellisense purposes
Set tvw = Usercontrol1.TV
Call tvw.Nodes.Add (Text:="Hello")
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 26th, 2002, 01:42 PM
#15
PowerPoster
For a treeview, swap out the textbox code:
Code:
Option Explicit
Private myBox As TextBox
Public Property Let MyTextBox(txtExample As TextBox)
Set myBox = txtExample
End Property
Public Property Get MyTextBox() As TextBox
Set MyTextBox = myBox
End Property
-
Oct 26th, 2002, 01:43 PM
#16
Thread Starter
Need-a-life Member
Damned!! I was trying to avoid that! I mean, it won't be that intuitive for the UserControl's user.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:48 PM
#17
Thread Starter
Need-a-life Member
Originally posted by Lethal
For a treeview, swap out the textbox code:
Code:
Option Explicit
Private myBox As TextBox
Public Property Let MyTextBox(txtExample As TextBox)
Set myBox = txtExample
End Property
Public Property Get MyTextBox() As TextBox
Set MyTextBox = myBox
End Property
Am I not following you? I don't think that code would work. The TreeView is on the UserControl. I would like to let the user Interact with it.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 01:55 PM
#18
PowerPoster
Ah..got ya...i read the question 2 quick...then, you are left with the code crypt provided or just expose methods through your code that automate what you want to provide for the user.
-
Oct 26th, 2002, 02:03 PM
#19
Thread Starter
Need-a-life Member
-
Oct 26th, 2002, 02:10 PM
#20
Thread Starter
Need-a-life Member
Sorry... I've uploaded the file again because the first one didn't work.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Oct 26th, 2002, 02:28 PM
#21
Thread Starter
Need-a-life Member
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
|