Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic Changes Controls to Picture Boxes - bug?

Status
Not open for further replies.

ptj

Programmer
Oct 5, 2001
46
0
0
GB
I and several of my colleagues have encountered an irritating bug with VB 6 (sp5). Periodically you load a project & suddenly get a load of 'errors in formwhatever, see the .log file'. VB has lost a reference to either a date picker, or a perhaps a status bar & has changed them all to picture boxes.

You can, of course, re-do the reference, but that doesn't change all the wretched controls back to what they were - what a nightmare! In a big project you can waste hours returning it to how it was!! The problem seems to occur most frequently after an .exe has been compiled, so we have got into the habit of saving the development folder immediately before doing this, but it still catches us out occasionally.

So:

a) Has this happened to anyone else?
b) Why does it happen?
c) How can we stop it happening?
d) If it does happen, is there a quick solution?

Thanks in anticipation,

Phil
 
a) Yes it happens to me often :)
b) It happens because the References are broken. This means the GUID of the used Controls aren't correct in the .vbp file
c) I don't know why this happens to you, and so I can't give any relaiable suggestions to stop it from happening. But there has to happen something to the controls GUID...
In my case there have been version incompatibilities of the controls on different machines and I was working with Visual Source Save and so I just had the wrong GUIDs of the other machines where other versions of my controls were installed...
d) I solve the problem the same way as you do, I re-do the reference. But the suggestion to not loose your controls on your forms is to only save the project file after re-doing the references and not to save any of the forms that threw an error when opend. Then you can reopen the project and everything should be right again... This works because the GUID that is relevant to VB resides in the project file (VBP) and this GUID isn't correct. To track the error, why this GUID is broken you can look at the ID in notepad for example. Just do solve the problem faster I've made a copy of my .vbp and whenever the references were broken I left VB, replaced the .vbp with the copy and started VB again.

hope this helps
Andreas
 
Many thanks - very useful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top