Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / April 2005



Tip: Looking for answers? Try searching our database.

Expected list seperator

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Drew Myers - 15 Apr 2005 23:00 GMT
I am getting a compile time error in VB on this line of code:

MyIF.ACollection.AnItem(13).AProperty = EnumMember

This gives me "Compile error: Expected: list seperator" and
highlights the second parenthese.  Has anyone seen this and have
a solution?

Thanks,
Drew
Ken Halter - 15 Apr 2005 23:27 GMT
>I am getting a compile time error in VB on this line of code:
>
[quoted text clipped - 6 lines]
> Thanks,
> Drew

Assuming that's pseudo code 'cause "ACollection" (assuming a collection
object that contains objects) doesn't have a property/method called
"AnItem".

Can you post more details?... is something like this what you're after?

'==============Class1 Code
Option Explicit

Public Test As Long
'==============Form Code
Option Explicit

Private Enum TestThis
  ttZero
  ttOne
  ttTwo
End Enum

Private Sub Form_Load()
  Dim o As Collection
  Dim oC As Class1

  Set o = New Collection
  Set oC = New Class1

  oC.Test = 12345

  o.Add oC
  Debug.Print o(1).Test

  o.Item(1).Test = ttTwo
  Debug.Print o(1).Test
  'or
  o(1).Test = ttOne
  Debug.Print o(1).Test

End Sub
'==============

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Sign up now to help keep VB support alive - http://classicvb.org/petition
Please keep all discussions in the groups..

MikeD - 15 Apr 2005 23:50 GMT
> >I am getting a compile time error in VB on this line of code:
> >
[quoted text clipped - 10 lines]
> object that contains objects) doesn't have a property/method called
> "AnItem".

And just to emphasize even more....if you're getting a syntax/compile error,
pseudo code is NOT going to be helpful in determining the reason for it.
We'd need to see your EXACT code. Always best to copy your code from the IDE
and paste it into the message.

Signature

Mike
Microsoft MVP Visual Basic

Drew Myers - 18 Apr 2005 17:46 GMT
OK.  There is definitely an AnItem property in ACollection.  Here's the
code:

Option Explicit

Sub Main()

   Dim TheApp As MyApp.Application
   Dim MyDoc As MyApp.Document
   Dim MyIF As MyApp.IF

   ' Start MyApp
   Set TheApp = New MyApp.Application

   ' For script debugging we can show MyApp
   TheApp.Visible = True

   ' Open a document
   Set MyDoc = TheApp.Document
   MyDoc.Delete "C:\temp\Dummy.txt"
   MyDoc.Open "C:\temp\Dummy.txt"
   Set MyIF = MyDoc.IF

   ' Read a file and fill in the collection
   MyIF.Read "c:\temp\file_with_collection.txt"

   ' Set a property in a specific item of the collection
   MyIF.ACollection.AnItem(1).AProperty = EnumMember

End Sub

Thanks,
Drew

>> >I am getting a compile time error in VB on this line of code:
>> >
[quoted text clipped - 17 lines]
> IDE
> and paste it into the message.
Alexander Nickolov - 18 Apr 2005 21:31 GMT
Post the IDL definition of AnItem within its interface. BTW, I
assume this is an ATL question.

Signature

=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

> OK.  There is definitely an AnItem property in ACollection.  Here's the
> code:
[quoted text clipped - 51 lines]
>> IDE
>> and paste it into the message.
Drew Myers - 18 Apr 2005 23:59 GMT
> Post the IDL definition of AnItem within its interface.

//  Primary dispatch interface for CACollection
[
 object,
 version(2.0),
 odl,
 uuid("64E4B5B8-866A-4598-9F43-935EA6942FF5"),
 dual,
 hidden,
 nonextensible,
 oleautomation,
 pointer_default(unique)
]
interface _IDualACollection : IDispatch
{
 [propget, id(1)]
  HRESULT Count([out, retval] long* num);
 [propget, id(2), helpstring("An object")]
  HRESULT AnItem([in]long num, [out, retval]_IDualAnItem** pdp);
 [id(3), helpstring("Adds an object")]
  HRESULT Add([in] long number, [in] long number, [out,
retval]_IDualAnItem** prop);
 [id(4)]
  HRESULT Remove([in] long num);
 [propget, restricted, id(DISPID_NEWENUM)]
  HRESULT _NewEnum([out, retval] IUnknown** ppienum);
}

>BTW, I assume this is an ATL question.

Well, I guess not strictly.  The server is written using ATL but it's the
client (VB)
giving the error.  I just thought that many ATL developers use VB as test
clients
and may have seen this error before.

Thanks,
Drew

>> OK.  There is definitely an AnItem property in ACollection.  Here's the
>> code:
[quoted text clipped - 51 lines]
>>> IDE
>>> and paste it into the message.
Alexander Nickolov - 19 Apr 2005 00:45 GMT
Looks fine to me... Can you try to do dereferencing in steps
and see where it starts failing? E.g.

set col = MyIF.Collection
set item = col.AnItem(13)
let item.AProperty = EnumMember

Signature

=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

>> Post the IDL definition of AnItem within its interface.
>
[quoted text clipped - 93 lines]
>>>> the IDE
>>>> and paste it into the message.
Drew Myers - 19 Apr 2005 17:52 GMT
It looks like it's just not possible to set a property using this syntax:

MyIF.ACollection.AnItem(1).AProperty = EnumMember

This, however:

Set item = MyIF.ACollection.AnItem(1)
item.AProperty = EnumMember

works.

Thanks for your help,
Drew

> Looks fine to me... Can you try to do dereferencing in steps
> and see where it starts failing? E.g.
>
> set col = MyIF.Collection
> set item = col.AnItem(13)
> let item.AProperty = EnumMember
Brian Muth - 19 Apr 2005 21:05 GMT
I just whipped up a VB6 DLL which implements a collection of objects. I can
assure you that it is quite valid to use:

MyIF.ACollection.AnItem(1).AProperty = EnumMember

and if it can be done in VB6, it can certainly be done with an ATL COM
implementation. Note that if EnumMember is an object, the syntax needs to be

Set MyIF.ACollection.AnItem(1).AProperty = EnumMember

You might want to do the same, then dump the IDL that VB6 creates, and see
how it compares with yours...

HTH

Brian
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.