NaN
NaN

Reputation: 567

VB6 How to pass variables to different form

I am starting with 1 form and 1 class. The idea is to set some class members and then call those members from a different form. I can't even set the values for some reason. We have a project done in VB6 and unfortunately, there is no chance to upgrade and am stuck on VB6.

Form1:

Public SomeClassObj As New SomeClass

Private Sub Command1_Click()
  Set SomeClassObj.Test1 = 1
  Set SomeClassObj.Test2 = 2
  Call SomeClassObj.Test
End Sub

Class SomeClass:

Public Test1 As Integer
Public Test2 As Integer

Public Sub Test()
  MsgBox Test1
  MsgBox Test2
End Sub

The error I get is "invalid use of property" and stops on Command1_Click: ".Test1 ="

Can someone please tell me what I'm doing wrong?

Upvotes: 0

Views: 207

Answers (1)

Arvo
Arvo

Reputation: 10570

You should remove Set keywords - you are not assigning objects/references.

Upvotes: 1

Related Questions