Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old June 11th, 2003, 11:02 AM
Authorized User
 
Join Date: Jun 2003
Location: Livermore, CA, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Project.Class.Property. ?

Ok. For instance ADO has
ADODB.RECORDSET.Field.Value

Adodb is the project, Recordset is the Class, Field is the property, what is Value? Sub Property?

I want to add a Size property associated to my Name Property inside my class. (So you get the . List in vb when you use the Name Property)

How do I do this?
  #2 (permalink)  
Old June 11th, 2003, 11:10 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

ADODB.RECORDSET.Field returns an object as the result of the property. VB is smart when you say .VALUE and says "hey, lets get the object and then take that and do a .value to it)

it's like doing this:
Code:
myField = ADODB.Recordset.Field("FieldName")
myValue = myField.Value
Now, I am not sure why you would want a size property- as Name is likely to be of type String. String in itself is an object and you can use the name object and use .length on the string to find out it's length.

Hal Levy
Daddyshome, LLC
  #3 (permalink)  
Old June 11th, 2003, 11:12 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I just realized this is VB- not VB.NET...

In that case use len(myName) and get the length of the string.

Hal Levy
Daddyshome, LLC
  #4 (permalink)  
Old June 11th, 2003, 01:37 PM
Authorized User
 
Join Date: Jun 2003
Location: Livermore, CA, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I just used Name for instance.
I have a class that sends messages. Each message has its own set of rules for each property. IsRequired, MaxLength, DataType.

I want the application to be able to test the data going into the class before it gets there, based on the rules (or properties) for each property.
For instance:
dim myClass as new Transactions.NewMessage
if MyClass.MessageBody.IsRequired then
  if len(MyVariableGoingToClass) <> MyClass.MessageBody.MaxLength then error
end if

Some other properties may have a SubRoutine associated to that property, Like:
MyClass.MessageBody.Build()

So when you look at the entire hierarchy, you see:
Transactions.NewMessage.MessageBody.Build()

How would I do that?
  #5 (permalink)  
Old June 11th, 2003, 03:10 PM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Depends on the design and the language.. In .NET
One way is create a method .build() on the messagebody class... The messagebody class could be a class inherited from string, so you only need to make your one method.

The MyClass.MessageBody property would return a MessageBody Object.

Hal Levy
Daddyshome, LLC


Similar Threads
Thread Thread Starter Forum Replies Last Post
Property access from Class within Partial Class zoltac007 C# 2005 0 December 1st, 2006 01:01 AM
Why no UserID property in the Membership class mega ASP.NET 2.0 Professional 0 August 16th, 2006 02:01 AM
Get all property values of class rrhandle ASP.NET 1.0 and 1.1 Basics 1 January 12th, 2006 05:13 PM
Access to a property in the class. AyatKh ASP.NET 1.0 and 1.1 Basics 2 December 18th, 2003 11:25 AM
Project.Class.Property.? Jstmehr4u3 Pro VB 6 2 June 11th, 2003 11:29 AM





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