尝试显示表单设计器时出错。
查看错误图片:
屏幕代码:
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)
- 在System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32)中隐藏调用堆栈 errorCode,IntPtr errorInfo)at Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(的Int32 hr,Int32 [] expectedHRFailure)at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(字符串 fileName,FileAccess访问,字符串 createTemplate,Boolean addToHostList, Boolean nestedItem)at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetChildDocData(字符串 name,FileAccess访问,字符串 createTemplate)at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.GetResourceDocData(的CultureInfo 信息,FileAccess访问)在 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.System.ComponentModel.Design.IResourceService.GetResourceReader(的CultureInfo 信息) System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadata() 在 System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadataEnumerator() 在 System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertiesFromResources(IDesignerSerializationManager 经理,对象值,属性[] 过滤器) System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager 经理,CodeTypeDeclaration 声明) System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager 经理) Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost 主机)
醇>
答案 0 :(得分:42)
冰雹玛丽:重新启动Visual Studio为我工作。
答案 1 :(得分:3)
此问题可能是由项目属性/设置文件的更改引起的。如果最近对设置进行了更改,请执行以下操作: -
这可以解决您的问题。