×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

What is a "Public Object Module

What is a "Public Object Module

What is a "Public Object Module

(OP)
I'm trying to implement

type objpt
x as single
Y as single
end type

Here is my class

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "Objpt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Private mvarX As Single 'local copy
Private mvarY As Single 'local copy
Public Property Let Y(ByVal vData As Single)
mvarY = vData
End Property

Public Property Get Y() As Single
Y = mvarY
End Property

Public Property Let X(ByVal vData As Single)
mvarX = vData
End Property

Public Property Get X() As Single
X = mvarX
End Property

compilation-wise, it looks beautiful. but this simple code blows it:

Public Function PointOf(X As Single, Y As Single) As Objpt
PointOf.X = X
PointOf.Y = Y
End Function

What am I missing?

RE: What is a "Public Object Module

Public Function PointOf(X As Single, Y As Single) As Objpt
Set PointOf = New Objpt
PointOf.X = X
...

combo

RE: What is a "Public Object Module

(OP)
I thought you had it, but no. It found something else to complain about.

Public Sub VCircle(p0 As Objpt, Radius As Single, Color As Long)
Dim P As Objpt
Dim Angle As Single 'current Angle
For Angle = 0 To 360 Step 10
PolarToCartesian Radius, Angle, P
Pic.Line (p0.X, p0.Y)-(P.X, P.Y), 0 'first inter-segment boundary
Next
End Sub

is a method in the new user control based on PictureBox.

Public Sub run()
Set p0 = New Objpt
p0 = PointOf(0, 0)
pic1.SetScale 5 '5 inch picture, target scaling
pic1.VCircle p0, 2.5, 0 'centered 2.5 inch radius starburst, black
End Sub

This is my first use of the new control in my .frm that contains the new control.

The error "ByRef argument type mismatch" occurs on the last reference to p0.


RE: What is a "Public Object Module

You have not instantiated or initialised P in VCircle, so VCircle fails on the PolarToCartesian line. You need to switch to 'Break in Class Module" for your error handling (Tools -> Options -> General -> Error Trapping) to see this

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close