PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Invalid Control Array Procedure-VBForums
Results 1 to 6 of 6

Thread: Invalid Control Array Procedure

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2003
    Location
    Newark-on-trent, Nottingham
    Posts
    241

    Angry Invalid Control Array Procedure

    I have a database connection with the fields 01,11,21,31 etc.

    I wish to determine whether the number in each of these fields matches the label of the same name. Im trying to be as clear as possible so heres an example:

    The field "01" in the database contains the number "9" i am trying to determine whether label2(9).forecolor=&HFF0000.

    My if statement once the database Connection is open is as follows:

    HTML Code:
    If 
    Autocall.Label2(IsNull(moRs("01"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("11"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("21"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("31"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("41"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("51"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("61"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("71"))).ForeColor = &HFF0000 
    And Autocall.Label2(IsNull(moRs("81"))).ForeColor = &HFF0000 
    Then
    The error im receiveing relates to this if statement and not the Database connection which i know works okay, the error is as follows:

    Run-time Error: '341'

    Invalid Control Array Procedure

    I hope that this post makes sense and i hope even more that someone can help me sort this issue out!

    Thank-you in Advance

    Steve

  2. #2
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Invalid Control Array Procedure

    the control array is expecting an integer value as its index, you are supplying a boolean from the IsNull() function. try using the Val() function to get the value of the string to pass as the index number.

    casey.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2003
    Location
    Newark-on-trent, Nottingham
    Posts
    241

    Smile Re: Invalid Control Array Procedure

    VBGirl your my hero!

    Worked a treat the new if statement is as follows:

    VB Code:
    1. If Autocall.Label2(Val(IsNull(moRs("01")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("11")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("21")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("31")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("41")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("51")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("61")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("71")))).ForeColor = &HFF0000 And Autocall.Label2(Val(IsNull(moRs("81")))).ForeColor = &HFF0000 Then

    Thanks Again

    Steve

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2003
    Location
    Newark-on-trent, Nottingham
    Posts
    241

    Smile Re: Invalid Control Array Procedure

    but....

    theres always a but isnt there... the code works fine but sadly the concept is floored.

    I am creating a random number in my form called Autocall when a number is generated the label containing that number for example Label2(23) has its forecolor changed.

    When getting this infomation on another form using the Autocall.label2(23) etc. i get the setup of the label prior to generating any numbers so the color in its opinion is still the same and has not changed why is this?

    It would appear that even though my Autocall form is working a secondary form cannot access the uptodate information.

  5. #5
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Invalid Control Array Procedure

    how exactly are you updating the second forms label after you have changed the forecolor of the label in the first form ?

    casey.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2003
    Location
    Newark-on-trent, Nottingham
    Posts
    241

    Re: Invalid Control Array Procedure

    Basically if i click on a button it loads a new form which opens the database and asks if the label on the original form is a certain color (if Autocall.Label2(Val(IsNull(moRs("01")))).ForeColor = &HFF0000 then)

    Unfortunatly the answer is always no even if it has visibly changed color and that number has been generated. It seems to think that the caption of that particular label and the color are as they were before i started generating numbers and changin label forecolors.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width