Results 1 to 5 of 5

Thread: [RESOLVED] argument not optional

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    13

    Resolved [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

  2. #2
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    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.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    13

    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

  4. #4
    Fanatic Member Comintern's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    826

    Re: argument not optional

    Code:
    For i = 1 To datefilelength
        Call List1.AddItem(events(i).appointments)
    Next i

  5. #5
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: argument not optional

    oops

    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
    Last edited by Milk; Jan 17th, 2008 at 08:47 PM. Reason: because I can't spell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width