Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2004, 08:10 PM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB Property Set question


My property set statement has an arglist because the matching get statement has args and the rule is let/get have the same args, but with let having +1.

How can I assign the let property in the code?

EG - Public Property Set Category(ByVal Var1 As String, _
 ByRef Var2 As Variant, ByRef Var3 As Variant,ByRef Var4 As Variant, ByRef Var5 As Variant, ByVal rsNewValue As ADODB.Recordset).


In the calling code, how does the set statement look?

I can't do Set object.Category = rsCategory... VB errors out with the runtime error, "Argument not optional."

There are NO examples out there save for single variable sets. HELP!!!
 
Old June 21st, 2004, 01:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I understand you correctly, the only reason you are passing the parameters Var1, Var2, etc. is because those parameters exist in the matching Get statement, Get Category(). It looks like the objective of your Set property is to update a database or something of that nature.

If this is true then this may help you.

You are not required to have a "matching" Get\Let\Set statements. You can use the Get Category() property by itself without using a related Let or Set property. Then create a public function, such as SetCategory(ByVal rsNewValue as ADODB.Recordset), named to your liking.

To return the property values call your Get Category() property and to set the values call the SetCategory() function.

Hope this helps you,



Larry Asher
 
Old June 25th, 2004, 05:35 PM
tnd tnd is offline
Authorized User
 
Join Date: Jun 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Public Property Set Category(ByVal Var1 As String, _
 ByRef Var2 As Variant, ByRef Var3 As Variant,ByRef Var4 As Variant, ByRef Var5 As Variant, ByVal rsNewValue As ADODB.Recordset).

You call it by

Set a(var1, var2, var3, var4, var5) = rsNewValue

Doesn't this look like an array to you? If your property requiring multiple paramters and those parameters are not dimisions of array then you should write them as sub and functions.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Set Property value being lost asn187 ASP.NET 2.0 Professional 1 April 19th, 2007 03:09 PM
Set Listbox Selected property DaDeViL VB How-To 7 October 4th, 2006 04:04 PM
"Unable to set the FormulaArray property..." rduncan1 Excel VBA 2 August 18th, 2006 01:33 PM
Set accountExpires property r_ganesh76 C# 0 August 9th, 2006 01:16 AM
DataColumn .Unique property not being set gp_mk ADO.NET 3 November 4th, 2004 06:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.