24

尝试显示表单设计器时出错。

查看错误图片:

在此处输入图像描述

画面代码:

public partial class frmCanalVenda : frmEdit
{
    public frmCanalVenda(CanalVenda canal, Cliente cli)
        : base(canal)
    {
        InitializeComponent();
        bdsCliente.DataSource = cli;
        eabBar.ReadOnlyView = false;
    }

    private void frmCanalVenda_Load(object sender, EventArgs e)
    {
        try
        {
            Cursor.Current = Cursors.WaitCursor;

            bdsAgrupamento.DataSource = Agrupamento.GetAll(DatabaseAFV.Connection);
            bdsCanal.DataSource = Canal.GetAll(DatabaseAFV.Connection);
            bdsSubCanal.DataSource = SubCanal.GetAll(DatabaseAFV.Connection);
            bdsEspecializacao.DataSource = Especializacao.GetAll(DatabaseAFV.Connection);
            bdsOperacao.DataSource = Operacao.GetAll(DatabaseAFV.Connection);
            bdsPorte.DataSource = Porte.GetAll(DatabaseAFV.Connection);
        }
        finally
        {
            Cursor.Current = Cursors.Default;
        }
    }
}

图片文字

为了防止在加载设计器之前可能丢失数据,必须解决以下错误:

值不在预期范围内。

此错误的实例 (1)

  1. 在 Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure) 在 Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService 的 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) 隐藏调用堆栈。 Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetChildDocData(String name, FileAccess access, String createTemplate) 在 Microsoft.VisualStudio.Design.Serialization 中的 GetFileDocData(String fileName, FileAccess access, String createTemplate, Boolean addToHostList, Boolean nestedItem)。 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.System.ComponentModel.Design.IResourceService 上的 CodeDom.VSCodeDomDesignerLoader.GetResourceDocData(CultureInfo 信息,FileAccess 访问)。GetResourceReader(CultureInfo info) 在 System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadata() 在 System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadataEnumerator() 在 System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertiesFromResources( IDesignerSerializationManager manager, Object value, Attribute[] filter) at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio .Design.Serialization.CodeDom.VSCodeDomDesignerLoader。在 System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost 主机)处执行加载(IDesignerSerializationManager 序列化管理器)
4

3 回答 3

46

万岁玛丽:重新启动 Visual Studio 对我有用。

于 2013-04-11T17:52:49.940 回答
3

此问题可能是由更改项目属性/设置文件引起的。如果最近对设置进行了更改,请执行以下操作:-

  1. 检查设置 xml 文件是否不包含任何不需要的元素。
  2. 关闭 Visual Studio 并重新启动 VS 并打开项目

这应该可以解决您的问题。

于 2011-10-26T08:30:10.730 回答
0

卸载项目和重新加载项目对我有用。

于 2021-10-27T14:39:24.883 回答