Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2003, 04:24 PM
Authorized User
Join Date: Jun 2003
Location: Livermore, CA, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Building Objects

Ok. I have created a DataType that I want to use. Here is the code:

Public Type TTRansAE
    Body As String * 24
    CD As OutboundTransactionType
    BeginStamp As String * 10
    EndStamp As String * 10
    ExceptionCode As String * 1
    AddDelete As String * 1
End Type

CD is defined as OutboundTransactionType. This is a Public Enum (1-12)

So this works. I am able to build my object and send it to my Processing Function. In my processing function I am sending out messages over a wireless network. The problem is I have to send it to my API as a string. So I have to concantenate all values of the object into a string.
string = Trans.Body&Trans.CA&Trans.BeginStamp& ...etc.
Except, I want to build this into its own routine so that I can pass it different transaction types that may have more or less properties. So I was trying to add a "Count" property of the Type that I can set it be the number of properties. (So I can loop). Except you can't reference properties of a type by an index (or counter). So do I have to build a Collection? I was thinking an Attributes collection that would have the Key/Value combo for each property and is accessible through an indexed value.

Transaction.Attributes(0).value = "Test" would be the same as
Transaction.Attributes("Body").value = "Test" would be the same as
Transaction.Body = "Test".

Am I completely off base? Is this possible?:(
Reply With Quote
  #2 (permalink)  
Old June 10th, 2003, 08:00 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

One solution I see is to define a ITransaction class, and change
your TTransAE into a class that implements ITransaction.
ITransaction will have a method like:
public property get TransString() as String

All new transaction types will implement ITransaction and you
can put all them into a collection that you can use like this:

dim IT as ITransaction
for each IT in myCollection
  SendMessage IT.TransString

Was I clear enough?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query building anjurenjith SQL Language 0 August 2nd, 2007 05:07 AM
Chapter 10 - building objects kscase BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 5 April 23rd, 2007 04:55 AM
Building an E-Shop Varg_88 Beginning PHP 0 March 15th, 2006 05:25 AM
Building JK2 jakawan BOOK: Professional Apache Tomcat 1 December 18th, 2004 02:32 PM

All times are GMT -4. The time now is 08:17 AM.

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