My code, fired from a button in a OOBase form is:
Sub Intialise(Event As Object)
'Sets up listbox contests
Dim Form As Object
Form=Event.Source.Model.Parent REM CODE BOUND TO FORM BUTTON
Dim lstMonths As Object 'Listbox
lstMonths = Form.getByName("lstMonth")
lstMonths.addItem ("One", 1)
End Sub
When I click the button, I get the messeage " BASIC Runtime Error. Property or method not found"
If I use "msgBox lstMonths.Name" It returns the listbox name OK but I can't seem to access its methods . Can anyone tell me where I'm going wrong - the docs don't seem to shed any light on it
[Solved] List Box addItem method not working
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
[Solved] List Box addItem method not working
Last edited by Hacker John on Sun Jan 13, 2008 12:45 pm, edited 1 time in total.
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
Re: List Box addItem method not working
Cracked it. It appears that Form listboxes don't have the same methods as dialog listboxes. This code works:
lstMonths.stringitemlist()=Array("One", "Two", "Three")
This gives me the three entries in the parentheses as list items.
Using an array works too
Dim Arr (3) As String
Arr(0) = "one"
Arr(1) = "two"
Arr(2) = "three"
lstMonths.stringItemList()=(Arr)
Oh well, as you were!
lstMonths.stringitemlist()=Array("One", "Two", "Three")
This gives me the three entries in the parentheses as list items.
Using an array works too
Dim Arr (3) As String
Arr(0) = "one"
Arr(1) = "two"
Arr(2) = "three"
lstMonths.stringItemList()=(Arr)
Oh well, as you were!