问题:在vb.net中打开表单时 [英] Problem : when open forms in vb.net

查看:64
本文介绍了问题:在vb.net中打开表单时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用3层开发了一个VB.Net项目.表格打开没有任何问题.考虑以下情况.我打开一个窗体并立即关闭,然后打开另一个窗体并关闭,然后打开另一个窗体并关闭,依此类推.当我这样做直到一段时间时,表格会顺利打开.一段时间后,表单打开非常缓慢,应用程序也变得非常缓慢,有时会发生内存不足异常.

我已经以各种形式和类实现了IDisposable.我已经处置了所有非托管对象.

如何解决我的问题?

I have developed a VB.Net project using 3 tier. Form opened without any problem. Consider the following situation. I open a form and close immediately and then I open another form and close and I open another form and close and so on. When I am doing like this up to some time the forms are opened smoothly. after some time the forms opened very slow and also application becomes very slow and sometimes out of memory exception occurred.

I have implemented IDisposable in all forms and classes. I have dispose all unmanaged objects.

How to solve my problem?

推荐答案

老实说,要我们帮助您并不是一件容易的事,甚至可能是不可能的.如果不使用细齿梳来检查代码,我不确定是否有人可以帮助您.

您说您已经处置了所有非托管对象"-那么托管对象呢?

听起来确实有点像与内存相关的问题:我能给您的最好建议是尝试使用内存探查器"-可能会有所帮助.这里有一个: http://memprofiler.com/ [

恐怕是时候读书了!您基本上需要覆盖Dispose表单,它并不那么简单:
http ://blogs.msdn.com/b/ploeh/archive/2006/08/10/howtodisposemembersfromforms.aspx [
To be honest, it isn''t going to be easy - or probably even possible - for us to help you. Without going through your code with a fine tooth comb I''m not sure anyone can help you.

You say you have "disposed all unmanaged objects" - what about managed ones?

It does sound like a memory related problem of some kind: the best suggestion I can give you is "Try a memory profiler" - it may help. There is one here: http://memprofiler.com/[^] whioch has a frree fouteen day trial, but I cannot guarantee it will solve anything!



"I have found where is the problem. I have used user controls in my form. After form is disposed all user controls is not disposed. How to dispose usercontrol and all events for that?
Please help me."


Time for some reading, I''m afraid! You basically need to overide the form Dispose, which is not as easy as that: http://blogs.msdn.com/b/ploeh/archive/2006/08/10/howtodisposemembersfromforms.aspx[^]


您是否在表单上使用了图片?如果是,则进行答复.
did you use images on your forms ? if yes then reply.


通过对问题的如此广泛而笼统的描述,任何人都不可能帮助您.您还没有提供有关您的应用程序在需要花费很长时间才能显示的表单上进行操作的详细信息,也没有在您使用的任何大对象以及远程处理大文件操作上说什么,... ,...,...,...我的意思是,这可能是由大约一百万种不同的事物或多种事物的任何组合引起的.
With such a broad and generic description of the problem, it''s impossible for anyone to help you with this. You haven''t given anyn detail about what youre app is doing on the forms that take so long to show up, nor do you say anything abotu any possibel large objects your using, and remoting going on, large file operations, ..., ..., ..., ... I mean, this could be caused any about a million different things or any combination of mutiple things.


这篇关于问题:在vb.net中打开表单时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆