Solved

Checkbox does not want to be disabled

Posted on 2001-06-20
19
190 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now