Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Checkbox does not want to be disabled

Posted on 2001-06-20
19
192 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
A macro to Count the number of rows across all worksheets 3 126
Updates not working for MS Windows 7 12 181
Add and format columns in vb6 7 63
Dinamic report to Crosstab query 9 33
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

856 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