|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Creating a collection of a type block... Possible?Public Type NameBlock Name as String FirstName as string End Type can i Create a collection of this type block, so i can use the .add method and .remove method? like; Dim MyNameCol as new Collection of NameBlock or should i just create an array, like Dim MyNameVar() as NameBlock any suggestion? Thanks again.
Show quote
"Patrick Garceau" <garce***@microbusinfo.com> wrote in message If you want to use UDTs, you're basically limited to an array. You may want news:%23Q5vlC9VFHA.1404@TK2MSFTNGP09.phx.gbl... >I want to create a collection of a type block > > Public Type NameBlock > Name as String > FirstName as string > End Type > > > can i Create a collection of this type block, so i can use the .add method > and .remove method? > like; > > Dim MyNameCol as new Collection of NameBlock > > > or should i just create an array, like > > Dim MyNameVar() as NameBlock > to go through a few of these for some ideas. Results 1 - 100 of 402 for UDT Collection -dotnet group:*.vb.*. (0.58 seconds) http://groups.google.co.uk/groups?as_q=UDT+Collection&num=100&scoring=r&hl=en&as_epq=&as_oq=&as_eq=dotnet&as_ugroup=*.vb.*&as_usubject=&as_uauthors=&lr=&as_drrb=q&as_qdr=&as_mind=1&as_minm=1&as_miny=1981&as_maxd=13&as_maxm=5&as_maxy=2005&safe=off Basically, if you convert that UDT to a class module, you can use a collection or an array or.... anything you want. Classes don't suffer from the same restrictions as UDTs do... plus, they're far more flexible. Converting a User Defined Type to a Class Module http://www.vbsight.com/UDT_Class.htm -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Sign up now to help keep VB support alive - http://classicvb.org/petition Please keep all discussions in the groups.. > I want to create a collection of a type block <code snipped>> can i Create a collection of this type block, so i can use the .add method A UDT cannot be coerced into a Variant at runtime and as such cannot be stored in a collection. You may be able to make it work by> and .remove method? > or should i just create an array declaring the UDT in a typelib, otherwise just use an array or write your own collection object for that specific UDT. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ "Patrick Garceau" <garce***@microbusinfo.com>'s wild thoughts were released on Fri, 13 May 2005 11:17:53 -0400bearing the following fruit: >I want to create a collection of a type block I suggest using classes instead of types.> >Public Type NameBlock > Name as String > FirstName as string >End Type > J Show quote >can i Create a collection of this type block, so i can use the .add method Jan Hyde (VB MVP)>and .remove method? >like; > >Dim MyNameCol as new Collection of NameBlock > > >or should i just create an array, like > >Dim MyNameVar() as NameBlock > > > >any suggestion? > >Thanks again. > -- A forger is a man who made a name for himself. (Henny Youngman) [Abolish the TV Licence - http://www.tvlicensing.biz/]
Other interesting topics
|
|||||||||||||||||||||||