Results 1 to 20 of 20

Thread: (RESOLVED) CheckBox Wierdness .Value Not Availbale

  1. #1

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101

    (RESOLVED) CheckBox Wierdness .Value Not Availbale

    ok i have been trying to save the valuer of a checkbox being 0 1 or 2 0 being clear, 1 being checked and 2 being checked and grey! howver the checkbox.value member seems to have vanished anyone got a clue whats gone wrong i have enclosed a an attachment for the code and the missing option!
    Attached Images Attached Images  
    Last edited by Cenobitez; Jan 4th, 2004 at 03:16 PM.

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    If you have an array of the controls, remember to add (0)

  3. #3

  4. #4

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    Ive no idea what the problem is when i open a fresh project the .value option is there yet in the Trivia program i am using i cant get it to appear anywhere!

    Martin i was under the impression that 0,1,2 was faster ?

    I have always used the integer value since thats that the IDE uses

    I think im just gonna have to create the form in another project and try to transfer it overor use Yes and No option boxes instead!

    Il leave this as unresolved until i figure something out!

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Zip up your project and post it.

    It really doesn't matter which is faster unless you are in a routine that evaluates many checkboxes. The important thing is maintenance and it's much easier to maintain a program which says If Check1.Value = vbGrayed then it is one that says If Check1.Value = 2.

  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    If for some reason you can't or don't want to post your project then at least show us what any one of your checkbox's Click event looks like. It should be something like

    Private Sub Check1_Click()

    and not


    Private Sub Check1_Click(Index As Integer)

    If it looks like the latter then you are working with a control array.

  7. #7
    Addicted Member imbue's Avatar
    Join Date
    Aug 2002
    Location
    Midwest USA
    Posts
    155
    I don't think it's a control array. If it were a control array then the screenshot would only have count, item, lbound, and ubound (I think, anyway).

    My guess is that you're somehow not actually using a check box. From the screenshot I think that a check box should have different methods/properties.

  8. #8
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Then there might be something else with checkbox's name (for example, a Boolean value named as chkEnabled).

  9. #9

  10. #10

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    this is the form the whole project is rather large at 450KB ZIPPED mainly due to me using "universale modules" ie the same modules thruought a dozen programs so that when i upgrade one i upgrade the rest since some of the methods need upgrading!
    Attached Files Attached Files

  11. #11

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    that form was wrote in a fresh project and worked fine, altho n need to fixe the form load so it ddesent erase my default option but il fix then when i have this issue fixed!

    As u can see it works fine and code is exact and "maintainable"

    As soon as i add this into my other project the methods and object members change and the .value vanishes!

    On a side note, like many programmers im kinda stuck in my ways over the vb intrinsic values, like vbminimized and such i prefer in larger application and infact any application to use the relevant number as it makes sense to me

    I am however constantly updating my coding conventions so i may lter

  12. #12
    Addicted Member imbue's Avatar
    Join Date
    Aug 2002
    Location
    Midwest USA
    Posts
    155
    Originally posted by Cenobitez
    ...
    As soon as i add this into my other project the methods and object members change and the .value vanishes!...
    I think that can really only mean that you have a public object with the same name somewhere else in your project.

  13. #13

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    Works ok on its own just not in my other project, i figure i must have declared something or changed a setting somewhere its not major deal, il use option boxes for now!

    at least i have an alternative on this one!

    Im thinking the same thing that im using it elsewhere, but i dont know why my error traps nor windows error traps have spotted it as i get no error it just dont work!

    This is like when i had a service pack install mess up and half the control wouldnt work and otherhalf said i had no licence to use in designed view i have to use an MS tool called CLIClient i think oh well this program is nearly finished so a simple optionbox control array will do
    Last edited by Cenobitez; Jan 3rd, 2004 at 09:09 PM.

  14. #14

  15. #15

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    im just gonna chalk this project up once i implement the saved values to variables and make them accessable to the program this project is done, then il work on stripping it to find the issue!

    I have just searched for it and i have 3 occurances of the chkKWEnabled, one is a Constant which is my default value for another checkbox called the same, but its in anothr form! and the one im working on now!

    I dont want to get side tracked now id sooner get the app to a "finished" state then "tweaking and refinement is eternal" il find the issue, i just added this URL to my comments so l find it

    Martin if you dont mind id rather not send the code as its messy very messy with comments everywhere and old commented code, and various methods of doing the same thing when i have updated and just commented the old out!, not the kinda code i like to give out, soon as its acceptably finished and i clean it up to post on planetsourcecode il be more than happy to send it if i still have the same fault!

  16. #16
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by Cenobitez
    ...I have just searched for it and i have 3 occurances of the chkKWEnabled, one is a Constant which is my default value for another checkbox called the same, but its in anothr form! and the one im working on now!...
    I'm sure that that is your problem. Change two of the three names so that all three are unique.

  17. #17

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    as they are private not public and on different forms they shouldnt interfere but i believe i found the problem!

    Global chkKWEEnabled As New Frame

    this was in the midded of a module called "RedunExps" which is where i put failed and/or redundant code with loads of comments as to why its no longer in use and what sub super seeded it, i like to see where i came from, and about 4 lines was uncommented including the global!


    I missed this in my search mainly due it being like 3am where i am in England and not noticing is wasnt commented out when the whole 50kb module was My Bad!

    I believe i was going to "manually" and on the go create the settings and options box as i have New Frame, New Label New Blah thru out, i do rmember that i was unsucsessful at this on other occasions!

    Took me about 1 minute to find after some sleep and coffeine!

  18. #18

  19. #19

    Thread Starter
    Lively Member Cenobitez's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, England
    Posts
    101
    Ordinarily i use

    frm for form
    int for integer
    bool for boolean
    frme for frame
    str for string
    txt for textboxes
    lbl for labels
    opt for option boxes
    ck for checkboxes

    Generally use standardized coding conventions but i believe this Global was a mistake possibly the reason i couldnt create the form at runtime!

  20. #20

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