[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference abbott::visual_basic

Title:Microsoft Visual Basic
Moderator:TAMARA::DFEDOR::fedor
Created:Thu May 02 1991
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2565
Total number of notes:10453

1915.0. "Weird compile and run time errors?" by PMRV70::TREMELLING (Making tomorrow yesterday, today!) Fri Jun 09 1995 11:25

T.RTitleUserPersonal
Name
DateLines
1915.1a couple of ideasWNPV01::AMESW1GUUFri Jun 09 1995 14:2612
1915.2also save as textSTOWOA::BRAITHWAITEWed Jun 14 1995 18:137
1915.3another weird run time errorPCBUOA::GARDESThu Feb 06 1997 12:1328
    I've got another weird one - this is tough to describe - anyone seen 
    this or have any ideas...
    
    I have an executable that runs fine when VIsual Basic is not running
    on my system - when I have Visual Basic design time running with the same
    project that the .exe is, the exe runs fine - when I have Visual Basic
    design time running with either a new project, or a different project
    from the .exe, the SAME .exe gives a "type mismatch" error.
    
    Putting in lots of MsgBoxs tracks it down to the line
    	If Value = true
    where Value is the value of a check box that is in the click event
    handler.  Changing this to "If Value" doesn't help.
    
    It seems this click event (setting a false checkbox to false) does not
    happen when Visual Basic is not running, and it does not happen when
    VIsual Basic is running the same project, yet it does happen when
    Visual Basic is running a new or different project.  Then the problem
    shows up.
    
    We are also starting to hear of some people in the field having
    problems with this same "type mismatch" error on the same .exe, and 
    they are not running Visual Basic.
    
    Two of us are very baffled by this - any clues what to do??
    
    Thanks,
    Sharon
1915.4Value - unfortunate choice ??PERFOM::MATTHESThu Feb 06 1997 13:366
    Is it possible that VB is assuming an object in front of the Value ??
    
    As in object.value
    
    What happens if you change the variable name to Vvalue or somesuch ??
    Value I thought might be a reserved word.
1915.5Change in OCX?JGODCL::BOWENAt long last he's here!Fri Feb 07 1997 03:5330
    We found this problem and although we don't know why it's happening I
    tell you what's going on.
    
    For some reason Checkboxes in 32bit VB4.0 do not have values of true or
    false as in VB3.0
    
    Rather they have Checked, Unchecked or Gray
    
    So instead of beeing mapped to the values of 
    	-1	true
    	 0	false
    
    They are now mapped to
    	0	Checked
    	1	Unchecked
    	2	Gray
    
    We ended up writing a little function that worked out the conversions
    for us.
    
    We suspect it's something to do with Office 97/VB5CCE since we only
    started having problems since those two were installed on the
    development machine.
    
    To double check if you have the problem right click on the control and
    look at the properties->Value
    
    HtH
    
    Kevin
1915.6Thanks, but...PCBUOA::FEHSKENSlen - reformed architectFri Feb 07 1997 09:409
    
    re .4 - "value" is the name of the formal argument being passed into
    the check box's click handler.  It was "declared" by VB itself.  There
    is no object reference associated with it.
    
    re .5 - this is a VB3 application.  We are not (yet) using VB4.
    
    len.
   
1915.7JGODCL::BOWENAt long last he's here!Fri Feb 07 1997 10:4813
    I've just had a look through the DOCs
    
    A Checkbox has always only had three values, Checked, Unchecked and
    Gray, this includes VB3.
    
    However it seems that in the past you could use the True/False to set
    the control, now this seems to be no longer possible.
    
    I refer you to page 596 of the VB3 Language Reference
    
    So it seems some of us have been getting away with it!
    
    Kevin
1915.8Yes, but...PCBUOA::FEHSKENSlen - reformed architectFri Feb 07 1997 12:5620
    
    These are 3D checkboxes.  See page 4 of the Professional Features Book
    1, Custom Control Reference - "Click Event".  I quote:
    
    "This is the same as the standard Visual Basic Click event, except that
    the control's Value is passed as an argument.  When the user selects
    the check box, Value = True.  When the user does not select it, Value
    = False."              ^^^^
      ^^^^^
    
    See also "Bound properties", page 2:
    
    "The 3D check box can only be bound to a field that is of boolean data
    type."                                                    ^^^^^^^
    
    "If the field value is NULL, then the Value property is set to 2, which
    means the check box is grayed."
    
    len.