无法绑定到 DataSource 的属性或列 PatchExamUserID

今天在工作中遇到的问题是每次打开公共表单总是报

**************************开始***************************

异常发生时间:2010-4-14 10:06:41

异常信息:无法绑定到 DataSource 的属性或列 PatchExamUserID

参数名: dataMember

异常堆栈:   System.Windows.Forms.BindToObject.CheckBinding()

   System.Windows.Forms.BindToObject.SetBindingManagerBase(BindingManagerBase lManager)

   System.Windows.Forms.Binding.SetListManager(BindingManagerBase bindingManagerBase)

   System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding dataBinding)

   System.Windows.Forms.BindingsCollection.Add(Binding binding)

   System.Windows.Forms.BindingContext.UpdateBinding(BindingContext newBindingContext, Binding binding)

   System.Windows.Forms.Control.UpdateBindings()

   System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)

   System.Windows.Forms.ListControl.OnBindingContextChanged(EventArgs e)

   System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs e)

   System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)

   System.Windows.Forms.ContainerControl.OnCreateControl()

   System.Windows.Forms.UserControl.OnCreateControl()

   System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

   System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

   System.Windows.Forms.Control.CreateControl()

   System.Windows.Forms.Control.SetVisibleCore(Boolean value)

   System.Windows.Forms.TabPage.set_Visible(Boolean value)

   System.Windows.Forms.TabControl.UpdateTabSelection(Boolean updateFocus)

   System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e)

   EcaClient.Windows.EcaForm.WinControl.customTabControl.OnSelectedIndexChanged(EventArgs e) 位置 E:/code/wheca/业务架构与集成平台/EcaClient.Windows/公共控件/EcaClient.Windows.EcaForm/WinControl/customTabControl.cs:行号 114

   System.Windows.Forms.TabControl.WmSelChange()

   System.Windows.Forms.TabControl.WndProc(Message& m)

   EcaClient.Windows.EcaForm.WinControl.customTabControl.WndProc(Message& m) 位置 E:/code/wheca/业务架构与集成平台/EcaClient.Windows/公共控件/EcaClient.Windows.EcaForm/WinControl/customTabControl.cs:行号 205

   System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

   System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

   System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

是否有内部异常:无

这种异常就是说文本框或下拉列表在绑定视图数据的时候,

一般这个时候该表单会有很多视图数据,错误的原因在于包含文本框或下拉列表的父控件所绑定的视图和自身的视图不是同一个视图,

 

在这个时候解决的方法就是,如果一个panel里面有多个文本框或下拉列表看它们所需要的视图是不是同一个视图如果不是的话,就把文本框或下拉列表panel拆开,分别给每个控件绑定视图。相反,如果没有panel的话有的控件不能选定自己需要的视图的话就给个panel然后把控件放进去就可以先给panel绑定视图,然后给控件帮顶视图。

在这里就是一点纠结,就是panel优先选择视图而在同一个panel里面只能帮顶一个视图。

还有就是在都panel的窗体里面有很多控件这些控件也会出现绑定错乱的情况,所以要对有些必要的控件要独立放在一panel里面。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值