vb.net DataGridView绑定后设计列名错误

时间:2015-01-15 13:52:06

标签: vb.net winforms datagridview bindingsource

在Visual Studio 2012 CRASH之后,设计中出现错误,
设计中的列名是使用末尾的数字生成的(例如:DataGridViewTextBoxColumn36),不带前面的ColumName(例如: FirstNameDataGridViewTextBoxColumn )。

我多次删除并重新绑定..可能是Visual Studio的错误?

***更新 我创建了一个新项目,一个表单,BindingSource和Datasource从db到同一个表,生成好了!

更新解决方案!!
谢谢@Jorj !!你救了我的一天!
在UserControl.Designer.vb中我发现重复!
解决方法是从.Designer删除重复项!

   Friend WithEvents IdDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
   Friend WithEvents FullNameDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
   Friend WithEvents PhoneDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn

   Friend WithEvents DataGridViewTextBoxColumn1 As System.Windows.Forms.DataGridViewTextBoxColumn
   Friend WithEvents DataGridViewTextBoxColumn2 As System.Windows.Forms.DataGridViewTextBoxColumn
   Friend WithEvents DataGridViewTextBoxColumn3 As System.Windows.Forms.DataGridViewTextBoxColumn

和许多重复......

   Friend WithEvents DataGridViewTextBoxColumn52 As System.Windows.Forms.DataGridViewTextBoxColumn
   Friend WithEvents DataGridViewTextBoxColumn53 As System.Windows.Forms.DataGridViewTextBoxColumn

this is my error This is how should be, and in other datagridview works ok Here is the DataSource for BindingSource to Patient Entity from Model

1 个答案:

答案 0 :(得分:2)

有时它会在VS崩溃后发生:列仍然在yourform.designer.vb中定义,因此您需要删除这些行。 它发生在我身上好几次:

   Friend WithEvents DataGridViewTextBoxColumn20 as System.Forms.DataGridViewTextBoxColumn