Solved

Checkbox does not want to be disabled

Posted on 2001-06-20
19
189 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now