arrays - Populate VB6 ListBox with single instruction -
in vb6 can't seem able that:
mylistbox.list = listcontentstringarrray
vb complaining compile error saying "argument not optional", because .list(index)
requires, well, index.
the following code works in vba:
private sub commandbutton1_click() dim result() string redim result(0) result(0) = "hello" redim preserve result(1) result(1) = "world" listbox1.list = result end sub
looking @ object browser found listbox in vba msforms.listbox
, in vb6 it's vb.listbox
.
the vba listbox's list property declared property list([pvargindex], [pvargcolumn])
, in vb6 it's property list(integer) string
, problem comes from.
is there way "swap" vb.listbox
msforms.listbox
in existing code base without breaking anything, or msforms
designed use in vba "vb" library isn't included in vba? if reference fm20.dll
in vb6 project, can see msforms.listbox
in object browser, not in toolbox.
it possible use forms 2.0
controls in vb6 application. instance, 1 of ways controls support unicode (see how read , display unicode string on visual basic form kb article).
if reference fm20.dll in vb6 project, can see msforms.listbox in object browser, not in toolbox.
to add controls toolbox have add microsoft forms 2.0 object library
via project | components menu item (ctrl+t):
but, frankly, if need ability 'populate vb6 listbox single instruction' huge overkill. code routine regular vb6 listbox
, you're done.
also keep in mind forms 2.0 controls not redistributable. info: usage , redistribution of fm20.dll kb:
the fm20.dll not redistributable. must have application such microsoft office 97 on target system installs fm20.dll part of setup... in case, may not distribute fm20.dll part of setup, if purchase microsoft office developer edition product.
as alternative having end users install microsoft office, can have them freely download , install microsoft activex control pad, installs fm20.dll.
Comments
Post a Comment