Solved

Checkbox does not want to be disabled

Posted on 2001-06-20
19
191 Views
Last Modified: 2010-05-02
When I tried my application on a specific computer, I got a white screen saying that an illegal operation occured. Even if on my computer it works fine.

I did some test and by putting a msgbox between each line, I figured out which line causes this error.
The line is :
chkRemoved.Enabled = False

where chkRemoved is a checkbox

Can anyone tell me why disabling a checkbox would cause an error and how can I work around this?

I think maybe it has something to do with the fact that my computer is under Windows 2000 and the one that is causing this problem is under Windows 95.
I'm using VB6 with SP5 in case it would change something.
0
Comment
Question by:Pennywisdom
  • 7
  • 3
  • 3
  • +4
19 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6211852
How are you getting your application to the other computer?  Setup program?  Running it in the IDE?
0
 

Expert Comment

by:nomulap
ID: 6211880
See if the font size setting on the client machine is same as your's. This will cause weird problems sometimes.
0
 

Author Comment

by:Pennywisdom
ID: 6211882
I installed it using a setup program made with the Package and Deployement wizard that comes with VB.

What is IDE?
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:Pennywisdom
ID: 6211900
nomulap :

Which font size should I compare? The font of the checbox with window text font? My windowtext font with the other computer's?
0
 

Expert Comment

by:nomulap
ID: 6211932
Windows Font Size. Go to Control Panel, double click Display click on Settings tab and check the Font Size.
0
 

Author Comment

by:Pennywisdom
ID: 6211960
The font size are the same on both computers
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6211976
IDE = Your development environment...

still thinking on the problem...
0
 
LVL 5

Expert Comment

by:gbaren
ID: 6212030
Change your video driver back to standard VGA and try your app. If the problem goes away, update your video driver.
0
 
LVL 3

Expert Comment

by:Hornet241
ID: 6212198
What event is this in?

     chkRemoved.Enabled = False

0
 
LVL 22

Accepted Solution

by:
rspahitz earned 200 total points
ID: 6212330
I've found that some objects crash when certain combinations are applied.  For example, if you try to set a textbox's alignment when the textbox is disabled, you get a serious error that takes down your IDE without warning.  (Microsoft acknowledged this bug when I sent it to them.)

I don't think that's the problem here, but I'd check:

1) Is chkRemoved a standard checkbox, or is it a third-party checkbox?
2) Is the checkbox already disabled?
3) Is the checkbox's container (form/frame/picturebox) already disabled?
4) If you add (not copy/paste) a new checkbox and apply the same command at the same spot (just before where the error occurs) do you get the same result, or is it only for this particular object?  If just for that object, start comparing setting and apply them to the new checkbox until they're the same.
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6213008
Did you try the samething in some other computer, and you get the same error?
0
 

Author Comment

by:Pennywisdom
ID: 6214123
Hornet241:
It's in a change event of a textbox

rspahitz:
1) it's a standard checkbox
2) the checkbox is not already disabled
3) it's container is not disabled
4) i'll do some test and i'll get back to you

valli_an:
I tried it on 3 computers and 2 of them gave me the error
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6214890
Hope the checkbox is Visible also.
0
 

Author Comment

by:Pennywisdom
ID: 6215498
I tried to add a new checkbox (Check1) a command button that toggles the Enabled property.
When the Checkbox has a caption it crashes but when the caption is empty it works ok (I think it has soething to do with my checkbox being 195x195 and having no place to display the caption).

So I tried removing the caption of chkRemoved but it still crashes.
After this I deleted chkRemoved and I renamed Check1 to chkRemoved without changing anything else and it still crashes.

Buy the way my checkbox is visible
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6215846
All this sounds like a problem with the checkbox, which I think is defined in the VB runtime library: MSVBVM60.dll  You may want to replace that, or at least check its date and size.

Meanwhile, if you can replicate the error in your design environment, I'd say:
--Start with a fresh project and see if the checkbox object gives you any problems.
--If not, try to copy the object from the faulty project and paste it into the new project.
--If not, copy/paste all the code and objects and see if it crashes.
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6216763
Can you put your source code? That, we could try it.

Cheers.
0
 

Author Comment

by:Pennywisdom
ID: 6218064
By adding new checkboxes and changing there Enabled property I found out that it was when the checkbox add a caption that the bug occured.

After discovering this I removed the caption from my original checkbox but I forgot that a part of my code changed the caption while loading the form. Since my check box is only big enought to see the white box, I did not see that the caption was there.

So I removed the part that changed the caption and now it works fine.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6218828
I'm glad you figured it out, but I still can't figure out why the checkbox caption would cause problems.

Anyway, at least you're through this issue!
0
 

Author Comment

by:Pennywisdom
ID: 6218911
When a checkbox is disabled the text changes color to show that it's no longer available.
To do this it's likely that the code changes the video memory even if the caption is not visible. So he would change the video memory at a place which is not associated with the checkbox. In other words he tries to write in a memory spot that is read-only to him.
This would cause an illegal operation.

At least that's the best explaination that I can think of.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 73
VB error "Type mismatch" 2 53
Paint/Redraw window while dragging 16 76
Set email body to html using vbscript 6 41
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question