Line shapes cause program crash
-
lundi 12 décembre 2011 18:11
I had a very odd problem with an even odder fix. I was wondering if anyone else experienced this or could explain it.
I am writing a Visual Basic program that currently contains about 80,000 lines of code and comments. I have a little over 100 forms in the project. It uses Visual Basic Power Pack for printing and line shapes. After adding a number of line shapes to a form, the program crashed. When I removed them it worked. Later, I experienced the same type of crash but had not added any line shapes immediately before the crash. Yet, when I removed line shapes from a form that was totally unrelated to the one I had been working on, the program worked. Odd, but true.
Any ideas what could have caused this? My program is working but I am afraid of having a similar problem in the future.
p.s., I have replaced most of the line shapes in the program with labels one pixel high. I get the same look on the form, without the line shape problem.
Earl Whitney
Toutes les réponses
-
mercredi 14 décembre 2011 14:57Modérateur
Hi Earl,
Welcome to the MSDN Forum.
Based on the description, it seems that this issue is related to the LineShape control.
Now, please post more detail information about this issue: such as the error message when the application crashed, any logs you have about this issue. The more important thing is how can we reproduce this scenario on our side. Would you like to post the detail steps here? It will be very helpful to us to find the root cause if you could.
Please note, when you try to reproduce this issue, please build a new project and try it. This is because this way can make sure there is nothing to do with your other 80,000 lines code.
Best regards,
Mike Feng
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
mercredi 14 décembre 2011 18:04
Mike, thanks for your response. I am unable to reproduce the error since I have moved on by replacing most of the lineshapes in my project with textboxes of height 1 pixel. However, I do remember that the error occurred at the point where the project was opening a form (frmFORMNAME.showdialog). I don't remember the exact error message, nor do I recall whether the form being opened contained lineshpapes. I do recall that the lineshapes I deleted to get the project to work were in different forms than the one where the error occurred.
That is probably not much help, and I apologize for that. But it is all I remember. If the error happens again, I'll attempt to reproduce it in a smaller project and send you the infomraiton you requested.
I posted because I was curious if anyone else had experienced the same problem and might know more about it. Thanks again for your response. Sorry I could not be of more help.
Earl Whitney -
jeudi 15 décembre 2011 06:02Modérateur
Hi Earl,
You are welcome.
It is OK you cannot reproduce this scenario now. And you can feel free to follow up this thread when you can do this.
Have a nice day.
Best regards,
Mike Feng
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
dimanche 25 décembre 2011 07:02
Hi,
I studied your entire issue in detail and infact created the test forms in VS2010. I put completely 496 shapes on form2 and on form1 button click i did form2.showdialog() which worked fine. So even I was unable to produce the error but when I turned off my graphics adapter I got the message illegal use of method ShowDialog().
So the moral of the story is that if you have too many shapes and you turn off your graphics adapter it can cause problems on systems having low memory. Powerpacks need graphics till what I have understood from the experiments i performed.
ThanksRehan Bharucha - The Tech Robot
MCTS, MCITP, MCPD, MCT
- Proposé comme réponse REHAN BHARUCHA dimanche 25 décembre 2011 07:02
- Modifié REHAN BHARUCHA dimanche 25 décembre 2011 12:48
- Non proposé comme réponse earlwhitney mercredi 28 décembre 2011 01:38
- Proposé comme réponse REHAN BHARUCHA mercredi 28 décembre 2011 09:26
- Marqué comme réponse Mike FengMicrosoft Contingent Staff, Moderator mardi 10 janvier 2012 11:27
- Non marqué comme réponse Mike FengMicrosoft Contingent Staff, Moderator mardi 10 janvier 2012 11:27
-
mercredi 28 décembre 2011 01:45I'm afraid I had more lineshapes than you tested, and I had them spread over 100+ modules. I have experienced a similar error once more, and I am currently in the process of replacing all lineshapes with 1-pixel wide labels and/or picturebox graphics. The error was a "maximum memory exceeded error," and it occurred when I tried to print (using the capabilities of the VS PowerPack). Perhaps lineshapes and their associated shapecontainer's take up a lot of memory. Is this possible? It seems the error is associated with the PowerPack since printing comes from there also. Is this a reasonable assumption? I'll let you know what happens when I finish deleting all the lineshapes. Earl
Earl Whitney -
mercredi 28 décembre 2011 07:46
Hi Earl,
How about changing a bigger memory for your PC?
Have a nice day.
Call me ghost for short, Thanks
To get the better anwser, it should be a better question. -
mercredi 28 décembre 2011 09:29
Hi,
I studied your entire issue in detail and infact created the test forms in VS2010. I put completely 496 shapes on form2 and on form1 button click i did form2.showdialog() which worked fine. So even I was unable to produce the error but when I turned off my graphics adapter I got the message illegal use of method ShowDialog().
So the moral of the story is that if you have too many shapes and you turn off your graphics adapter it can cause problems on systems having low memory. Powerpacks need graphics till what I have understood from the experiments i performed.
ThanksRehan Bharucha - The Tech Robot
MCTS, MCITP, MCPD, MCT
Hi Sir,Thats what I said in the above post, it needs a lot of memory if you put in a lot of shapes for graphics to render on the screen whether its direct memory or graphics dedicated memory, so your decision to migrate and replace lineshapes with 1 - pixel labels and picturebox is absolutely fine.
Go ahead and have a nice day..
Dont forget to upvote and mark an answer if it helped you so that others can benefit from the knowledge imparted.
ThanksRehan Bharucha - The Tech Robot
MCTS, MCITP, MCPD, MCT
- Modifié REHAN BHARUCHA mercredi 28 décembre 2011 09:30
- Proposé comme réponse REHAN BHARUCHA mercredi 28 décembre 2011 09:32
- Non proposé comme réponse earlwhitney jeudi 29 décembre 2011 00:46

