VB.NET 2005 problems with Designer not being able to process a code line

南笙酒味 提交于 2020-01-16 09:46:26

问题


I have a problem in my project with the .designer which as everyone know is autogenerated and I ahvent changed at all. One day I was working fine, I did a back up and next day boom! the project suddenly stops working and sends a message that the designer cant procees a code line... and due to this I get more errores (2 in my case), I even had a back up from the day it was working and is useless too, I get the same error, I tryed in my laptop and the same problem comes. How can I delete the "FitTrack"? The incredible part is that while I was trying on the laptop the errors on the desktop were gone in front of my eyes, one and one second later the other one (but still have the warning from the designer and cant see the form), I closed and open it again and again I have the errors...

The error is:

Warning 1 The designer cannot process the code at line 27:

Me.CrystalReportViewer1.ReportSource = Me.CrystalReport11

The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again. C:\Documents and Settings\Alan Cardero\Desktop\Reportes Liquidacion\Reportes Liquidacion\Reportes Liquidacion\Form1.Designer.vb 28 0


回答1:


I would back up the designer.cs file associated with it (like copy it to the desktop), then edit the designer.cs file and remove the offending lines (keeping track of what they do) and then I'd try to redo those lines via the design mode of that form.




回答2:


I would take out the static assignment in the designer to the resource CrystalReport11 and then add a load handler to your form and before setting the ReportSource back to CrystalReport11 do a check

If(Not DesignMode) Then Me.CrystalReportViewer1.ReportSource = Me.CrystalReport11

Here is a mockup..

Public Sub New()
    InitializeComponent()

    AddHandler Me.Load, New EventHandler(AddressOf Form1_Load)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
    If (Not DesignMode) Then Me.CrystalReportViewer1.ReportSource = Me.CrystalReport11
End Sub



回答3:


You should be able to take a backup, clear the lines that are having problems then when you re-open it the designer will fix the code.

The key is that you want to let the designer re-generate, then just validate that all needed lines are there.

That usually works for me, but you just have to be sure to remove all lines that it doesn't like.




回答4:


I do an easy way; Right Click on the report then choose Run Custom Tool.

Automatically it fixes all problems and working for me, i solve 52 crystal ReportViewer errors.



来源:https://stackoverflow.com/questions/85559/vb-net-2005-problems-with-designer-not-being-able-to-process-a-code-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!