|
-
Mar 5th, 2004, 04:41 AM
#1
Thread Starter
Frenzied Member
Methods of a property
This is a really silly question... but today I wrote a class which has a property which can be formatted in different ways. I have also written various subs in the class that formats a string (the property exposes a private string)....
if I want to access the methods like this:
myObject.MyProperty.MyMethod
How do I code this?
kind regards
henrik - thinking he has a total blackout and need to go back to vb.net 101
-
Mar 5th, 2004, 05:59 AM
#2
Hi.
If your property points to a class, just make a public sub inside the class.
e.g. Public Property MyProp as MyClass
Then just have the sub in MyClass.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Mar 5th, 2004, 06:06 AM
#3
Here's a small sample that I hope you find usefull.
VB Code:
Public Class My_Class
Dim m_MyPropClass As New MyPropClass()
Public Property MyProperty() As MyPropClass
Get
Return m_MyPropClass
End Get
Set(ByVal Value As MyPropClass)
m_MyPropClass = Value
End Set
End Property
End Class
Public Class MyPropClass
Public Sub ShowMessage()
MsgBox("Message Shown")
End Sub
End Class
'Usage...
Dim A As New My_Class()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
A.MyProperty.ShowMessage()
End Sub
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Mar 5th, 2004, 06:52 AM
#4
Thread Starter
Frenzied Member
okay thanks... I don't know where my thoughts wandered
kind regards
Henrik
-
Mar 5th, 2004, 07:14 AM
#5
PowerPoster
Hi,
It's very comforting to know that even you guys have a Brain.System crash occasionally
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
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
|