View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Functions 101 The basics

IMO UDTs are a good idea, but badly implemented in VB.

Very well put. I never use UDTs except when required by an API call. The
limitations on use UDTs with Collections and For Each loops make the barely
useful. I always use classes instead.

A Collection or Array of Class instances is much more manageable and
flexible than UDTs.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Bob Phillips" wrote in message
...
IMO UDTs are a good idea, but badly implemented in VB. If you are a
serious VB programmer, arrays are one of your basic tools, so handling
them should be meat and drink.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Martin Fishlock" wrote in message
...
Well I would actually prefer to return a user defined type (UDT) but I
didn't
really want to bring in UDT for a discussion on functions. It is a little
safer than arrays.

Arrays are fine but you then have to process them and deal with limits
etc.
But in some situations an array would be useful like split a line of text
into words.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Bob Phillips" wrote:

"Martin Fishlock" wrote in message
...

certain cicrmustances more than one variable is returned and then you
need to use globals or byref (like pointers in c(++)) so I could write
a
function

function splitinhalf(byval s as string, byref s1 as string, byref s2
as
string) as boolean

and this function whould split the string s in half and put the
answers in
s1 and s2 and return true on success and false otherwise.


or the function could return an array