Results 1 to 4 of 4

Thread: Help Needed

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Location
    England
    Posts
    198

    Help Needed

    Hi I am having a little trouble with my code.........here is what I currently have:

    Code:
    Private Sub initfrmCalendar()
    
      Dim i As Integer    'Used as a counter
      Dim iDay As Integer 'Used to set the day
       
      setStartIndex       'Set the starting index, first textbox to use
      setEndIndex         'Set the ending index, last textbox to use
      clearTextboxes      'Clear the calendar
      
      iDay = 1
      
      'Loop to fill the textboxes with days
      'Also to re-enable the disabled ones
      
    
      While iDay <= iEndIndex
      
    
        txtDay(iStartIndex).Text = iDay
        txtDay(iStartIndex).Enabled = True 'Re-enable
        txtDay(iStartIndex).BackColor = vbWhite 'Reset the color
        
        iDay = iDay + 1
        iStartIndex = iStartIndex + 1
        
    
      Wend
      
      
      disableUnusedBoxes
      
    
    End Sub

    Its giving an error msg on the txtDay part, saying "wrong number of arguments or invalid property assignment" the txtDay is currently a button and I what it to loop thou all the buttons, i have a control array txtDay handed coded as I am using vba,

    thanx


  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Help Needed

    Shouldn't "txtDay(iStartIndex).Text"

    be "txtDay(iStartIndex).Caption" instead?

    I don't know if "VBA" is different than "VB" or not on this one...

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Help Needed

    Quote Originally Posted by helen85 View Post
    I am using vba,
    VBA and VB6 are significantly different in several ways (particularly controls etc), which is why we have different forums for them - Thread moved from the 'VB6' forum to the 'Office Development/VBA' forum

  4. #4
    Addicted Member
    Join Date
    Apr 2009
    Location
    Toronto, Ontario
    Posts
    242

    Re: Help Needed

    Quote Originally Posted by vbfbryce View Post
    Shouldn't "txtDay(iStartIndex).Text"

    be "txtDay(iStartIndex).Caption" instead?

    I don't know if "VBA" is different than "VB" or not on this one...
    Got it in one vbfbryce. Since txtDay is button, then the ".text" should be ".Caption". This is no different than in VB6.

    helen85: You should try naming your controls to reflect their type. The name "txtDay" makes it appear that you're dealing with a textbox. Perhaps renaming the control to "cmdDay" or "btnDay" would remove some of the ambiguity.

    Cheers.
    -EM
    ---
    REMEMBER: If your issue is resolved, use the Thread Tools menu to set it as such, and be sure to rate the posts that help you the most!


    Just because I was jealous of g4hsean!

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