Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help setting up Properties?

Status
Not open for further replies.

Ferlin

Programmer
Jan 18, 2001
71
US
Hi All,

I'm trying to use a couple of Arrays in some properties, the problem
I am having is this, when I try to use the properties in my form to set
the Column Start and Column Lengths they are all set to 0. The reason
being that instead of using the Property Let in the .ColStart(?) = ##
the Property Get is being processed, I found this out by steping thru
the code with F8. I was wondering HOW to get around this, is this caused
by the fact that VB6 will not allow you to make an Array Public?

Below is an excerpt of code from the Class and the Form.

----------------------- Class Code (clsExport) --------------
Option Explicit

' clsExport
.
.
.
Private lngColStart() As Long
Private lngColLen() As Long
.
.
.
Public Property Get ColStart() As Variant
ColStart = lngColStart
End Property

Public Property Let ColStart(ByRef v_varColStart As Variant)
ReDim Preserve lngColStart(intNumCols)
lngColStart = v_varColStart
End Property

Public Property Get ColLen() As Variant
ColLen = lngColLen
End Property

Public Property Let ColLen(ByRef v_varColLen As Variant)
ReDim Preserve lngColLen(intNumCols)
lngColLen = v_varColLen
End Property

----------------------- Form Code (frmMain) -----------------
Option Explicit

' frmMain

Dim objExportXcl As New clsExport
.
.
.
objExportXcl.NumCols = 10
.
.
.
objExportXcl.ColStart(2) = 31
objExportXcl.ColLen(2) = 14
objExportXcl.ColStart(3) = 45
objExportXcl.ColLen(3) = 16
.
.
.
objExportXcl.NumCols = 4
.
.
.
objExportXcl.ColStart(2) = 31
objExportXcl.ColLen(2) = 15
objExportXcl.ColStart(3) = 46
objExportXcl.ColLen(3) = 21

-----------------------------------------------------------

Any help would be greatly appreciated, and Thanks In Advance.

Ferlin.
 
You need to modify the Arglist on your property get and set. Try something like this:

Public Property Get ColLen(intCol as Integer) As Variant
ColLen = lngColLen(intCol)
End Property

Public Property Let ColLen(ByVal intCol as Integer, ByRef v_varColLen As Variant)
ReDim Preserve lngColLen(intNumCols)
lngColLen(intCol) = v_varColLen
End Property

Then your assignments will work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top