[VB6] - how print an enum type?

Cambalinho_83
12-12-2011, 10:30 AM
we have the KeyCodeConstants enum type. but how can i print all enums?
Dim i As Long
Dim k As KeyCodeConstants
For Each k In KeyCodeConstants
Combo1.AddItem Chr(k)
Next
error message: "compile error: For Each may only iterate over a collection object or an array."
my objective is show "vbkeyup" string. how can i do it?

Cerian Knight
12-12-2011, 11:58 AM
I don't recall this being possible without manual assignments to an array or collection. Of course, this is trivial to accomplish in VB.NET: http://msdn.microsoft.com/en-us/library/58hssdz9%28v=vs.80%29.aspx

LeadEagle
12-13-2011, 10:46 AM
Hi, you can use TLBINF32.TLB for retrieving information about Types and Members of ActiveX DLLs. In your case, you need information out of the VBA Library (VBE6.DLL or VBE7.DLL).
"TypLibInfo" is the root object out of TLBINF32.TLB. So let's google for "New TypLibInfo" and then you will find some code samples.

Regards, LeadEagle

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum