[RESOLVED] argument not optional
i think this one might be really easy for more experienced people, but it has me stumped.
I try to add an item to a listbox (list1) using list1.additem
whenever I go to the sub (before it goes through it) it breaks and says "argument not optional"
Code:
Private Sub Calendar1_Click()
'some other file opening code
For i = 1 To datefilelength
List1.AddItem = events(i).appointments
Next i
End Sub
Re: argument not optional
Me being not so clever is unsure what events(i).appointments actually is, but i assume it's not a string.
Is it a UDT or Class? If so can you post the code that defines it.
Re: argument not optional
Quote:
Originally Posted by Milk
Me being not so clever is unsure what events(i).appointments actually is, but i assume it's not a string.
Is it a UDT or Class? If so can you post the code that defines it.
actually it is a string
Private Type appointment
appointments As String * 60
End Type
Dim events() As appointment
it can probably be a lot simpler, however i just dont know how
Re: argument not optional
Code:
For i = 1 To datefilelength
Call List1.AddItem(events(i).appointments)
Next i
Re: argument not optional
oops :blush:
Code:
List1.AddItem = events(i).appointments
'should be
List1.AddItem events(i).appointments
...but, I can't see the reason of
Code:
Private Type appointment
appointments As String * 60
End Type
Dim events() As appointment
over
Code:
Dim appointments() as String * 60
I assume theres a good reason.
edit: I see I've been beaten to it